Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MadcowD opened this issue May 1, 2016 · 16 comments
Closed

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

MadcowD opened this issue May 1, 2016 · 16 comments

Comments

@MadcowD
Copy link

MadcowD commented May 1, 2016

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;

}
@sunilmut
Copy link
Member

sunilmut commented May 3, 2016

@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.

@sunilmut
Copy link
Member

sunilmut commented May 3, 2016

Also see #118

@bobsummerwill
Copy link

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.

@misenesi
Copy link

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

@sunilmut sunilmut added fixed and removed fixinbound labels Nov 19, 2016
@sunilmut
Copy link
Member

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

@alehostert
Copy link

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

@aseering
Copy link
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?

@marcobehler
Copy link

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

@alehostert
Copy link

Thank you @aseering.

@sunilmut
Copy link
Member

sunilmut commented Dec 1, 2016

@marcobehler - I am not able to repro the above issue on build 14971 using the sample program posted by @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 @saschagehlich in #468 to disable the teredo interface. A fix for that is coming soon.

@mattrothenberg
Copy link

@sunilmut I can confirm that @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?

@marcobehler
Copy link

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

@sunilmut
Copy link
Member

sunilmut commented Dec 2, 2016

Glad to know @mattrothenberg and @marcobehler that it resolves both of your issues. @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.

@JasonLinMS
Copy link

@sunilmut Thanks for the great explanation.

@sunilmut
Copy link
Member

The teredo issue should be fixed in 15007

@sunilmut
Copy link
Member

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

joshfree added a commit to dotnet/corefx that referenced this issue Dec 12, 2017
* Re-enable DriveInfo test on Windows Subsystem for Linux

https://github.com/dotnet/corefx/issues/11570

* Re-enable additional tests on WSL

Related microsoft/WSL#1011 and microsoft/WSL#308

* correct xunit Facts

* Disable some network tests on WSL

Disable some network tests on WindowsSubsystemForLinux due to https://github.com/dotnet/corefx/issues/15513
picenka21 pushed a commit to picenka21/runtime that referenced this issue Feb 18, 2022
* Re-enable DriveInfo test on Windows Subsystem for Linux

https://github.com/dotnet/corefx/issues/11570

* Re-enable additional tests on WSL

Related microsoft/WSL#1011 and microsoft/WSL#308

* correct xunit Facts

* Disable some network tests on WSL

Disable some network tests on WindowsSubsystemForLinux due to https://github.com/dotnet/corefx/issues/15513


Commit migrated from dotnet/corefx@1e95551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests