Skip to content

ifaddrs.h: getifaddrs() causing invalid argument exception. #308

Closed

Description

@MadcowD

Hi. In alignement with my explorations today, it appears that ifaddrs.h is not fully implemented, or there is some other bug. Whenever one attempts to call getifaddrs(), errno is set to EINVAL.

This is causing issues in #134 and is probably just as related to #69 as anything else is. Furthermore, this is the reason why almost all of the LibZMQ tests seem to be failing. I've attached the test suite output after building libzmq and running make check. Finally this is causing errors with Anaconda, in particular the iPython or Jupyter notebook projects cannot use sockets to communicate between the browser and the iPython kernel, this is seen in this issue #1331.

The following code replicates the error:

#include <ifaddrs.h>
#include <iostream>
#include <errno.h>

int main(){
    ifaddrs *p = 0;
    int rc = getifaddrs(&p);

    std::cout << "Succeded ? " << rc << "\n";

    if(rc == -1){
        if(errno == 22)
            std::cout << "Invalid argument exception.";
    }

    std::cin.get();
    return 0;

}

Activity

  1. sunilmut commented on May 3, 2016

    @sunilmut
    Member

    William Guss (@MadcowD) getifaddrs requires NETLINK\RAW socket support, which unfortunately we don't have at the moment. Meanwhile, help us prioritize this by up voting network interface query support in our user voice page. Thanks for trying out WSL and providing us valuable feedback.

  2. sunilmut commented on May 3, 2016

    @sunilmut
    Member

    Also see #118

  3. bobsummerwill commented on Jun 10, 2016

    @bobsummerwill

    Hello! I'm seeing exactly the same issue for cpp-ethereum.

    I've worked through build errors in #147 and am now onto runtime errors, the first of which is a showstopper on getifaddrs().

    See https://twitter.com/BobSummerwill/status/740820732737904640.

    The failure is occurring very early on, at https://github.com/bobsummerwill/cpp-ethereum/blob/merge_repos/libp2p/Network.cpp#L82, in code which is likely very similar to networking code which many other Linux apps have.

  4. misenesi commented on Nov 10, 2016

    @misenesi

    Works on my latest internal builds, the fix should make its way to the insider builds eventually (if it already hasn't).

  5. sunilmut commented on Nov 19, 2016

    @sunilmut
    Member

    This is fixed in the latest insider build 14971. Thanks.

  6. alehostert commented on Nov 29, 2016

    @alehostert

    Hi, just a question.
    How many days would take to launch the fix on regular version? I'm not into Insider Program.

  7. aseering commented on Nov 29, 2016

    @aseering
    Contributor

    Hi hostert -- these improvements are scheduled to be released as part of the next major Windows version, which we've been told is scheduled for release sometime in maybe the first quarter or half of 2017?

  8. marcobehler commented on Nov 29, 2016

    @marcobehler

    Is this one really closed? I am on 14971 but am still experiencing the problem.

  9. alehostert commented on Nov 29, 2016

    @alehostert
  10. sunilmut commented on Dec 1, 2016

    @sunilmut
    Member

    Marco Behler (@marcobehler) - I am not able to repro the above issue on build 14971 using the sample program posted by William Guss (@MadcowD). Do you have the teredo interface installed by any means on your Windows box? If so, you might be running into #1414 or #468. See the workaround posted by Sascha Quartz (@saschagehlich) in #468 to disable the teredo interface. A fix for that is coming soon.

  11. mattrothenberg commented on Dec 1, 2016

    @mattrothenberg

    Sunil Muthuswamy (@sunilmut) I can confirm that Sascha Quartz (@saschagehlich)'s workaround posted in in #468 resolved my problem in trying to run Middleman (middleman/middleman#1960). Thank you so much! Care to explain (to a Windows & Ubuntu newbie like myself) what this change actually does?

  12. marcobehler commented on Dec 1, 2016

    @marcobehler

    Sunil Muthuswamy (@sunilmut) can also make it work with Sascha Quartz (@saschagehlich)'s workaround. (then the error goes away)...

  13. sunilmut commented on Dec 2, 2016

    @sunilmut
    Member

    Glad to know Matt Rothenberg (@mattrothenberg) and Marco Behler (@marcobehler) that it resolves both of your issues. Jason Lin (@JasonLinMS) can provide the exact details. But as I understand, the "Teredo Tunneling Pseudo-Interface" has a HW address of 32 bytes. In string format, each byte requires 3-byte for representation i.e 32*3 = 96bytes. While the 'ip' tool is hard coded to only expect 64 bytes overall. So, there is buffer overflow and the tool crashes.

  14. JasonLinMS commented on Dec 2, 2016

    @JasonLinMS

    Sunil Muthuswamy (@sunilmut) Thanks for the great explanation.

  15. sunilmut commented on Jan 13, 2017

    @sunilmut
    Member

    The teredo issue should be fixed in 15007

  16. sunilmut commented on Jan 19, 2017

    @sunilmut
    Member

    Closing this out. If anyone is still (on builds 15007+) having problems, please let us know and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions