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

SIOCGIFADDR, SIOCGIFNETMASK, SOCGIFBRDADDR not working #763

Closed
cole15601 opened this issue Aug 4, 2016 · 6 comments
Closed

SIOCGIFADDR, SIOCGIFNETMASK, SOCGIFBRDADDR not working #763

cole15601 opened this issue Aug 4, 2016 · 6 comments
Labels

Comments

@cole15601
Copy link

This maybe a duplicate of Issue #69, but SIOCGIFADDR et al are not working.

Sample source is:

strcpy(ifr.ifr_name, interface_name ); ifr.if_addr.sa_family=AF_INET; fd = socket(AF_INET,SOCK_DGRAM,IPPROTO_IP); if(ioctl(fd, SIOCGIFBRDADDR, &ifr) != -1) { //do something with the address } else { perror("Error getting IP:"); exit(-1); }

This produces the following output:

Error getting IP: Cannot assign requested address.

@sunilmut
Copy link
Member

sunilmut commented Aug 5, 2016

@cole15601 - Thanks for reporting this issue. WSL does currently support the SIOCGIFADDR, SIOCGIFNETMASK and SOCGIFBRDADDR , but only AF_INET sockets. Can you please share out full source so that we can repro it here locally?

@cole15601
Copy link
Author

@sunilmut - I'm using AF_INET sockets. Test source is attached.
SIOCTests.c.zip

Compile with gcc -g SIOCTests.c and run a.out and it produces the following output:

WSL Tests...
SIOCGIFADDR error : Cannot assign requested address.
SIOCGIFNETMASK error : Cannot assign requested address.
SIOCGIFBRDADDR error : Cannot assign requested address.

@onomatopellan
Copy link

onomatopellan commented Aug 18, 2016

WSL Test...
SIOCGIFADDR: eth0 IP addr is 192.168.1.33
SIOCGIFBRDADDR: eth0 IP addr is 192.168.1.255
SIOCGIFNETMASK: eth0 IP addr is 255.255.255.0

Seems it's fixed on insider build 14905.

@cole15601
Copy link
Author

Great, how does one get that insider build? Any idea when it goes out for public consumption?

@onomatopellan
Copy link

For public expected release for next milestone should be March/April.

WSL updates are coming to the Fast ring. To join in you need to go to Settings -> Update & Security -> Windows Insider Program and choose FAST ring. I don't recommend use them on your main PC though. It's better to use a VM or a Test PC/laptop as it can have bugs. (Shutdown StartMenu button doesn't work on build 14905 for example)

@sunilmut
Copy link
Member

Marking this as closed since it is fixed in the Insider builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants