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
sockets: bind to non-local address succeeds #460
Comments
@christoh - Thanks for reporting this. #395 is a different issue. This is something that we are aware of and the fix for it has a dependency on the underlying Windows network stack. We have communicated that but unfortunately its too late for Anniversary update. We should be able to fix this for the next release. Having said that, we are not aware of this issue causing any app compat problems. Are you aware of one? |
@sunilmut: No, I am not aware of any app causing serious problems. Most server apps do a bind followed immediately by listen. Since listen fails after bind incorrectly reported success, errors are handled almost correctly. The only minor issue is that the failure on listen reports EINVAL while bind reports EADDRNOTAVAIL. So the user sees "Invalid argument" instead of "Cannot assign requested address". So handle this with low priority and focus on /dev/pts and IPV6_V6ONLY ;-) Keep up the good work and don't worry that it won't be 100 % perfect in the anniversary update. Take your time to keep pressure on the kernel protocol stack people. BTW, just to make sure: This is not a "WSL does not support IP_FREEBIND" issue. I am stating this because you mention a dependency on the protocol stack. |
@christoh - Understood (the part about the IP_FREEBIND). This is something that we have known about, but it hasn't given us much pain in terms of compat so far. But, we are looking to fix this in future. Thanks for your understanding and trying out WSL! |
With the help of the Windows networking team, we were able to fully implement the IPV6_V6ONLY flag. Hopefully this should resolve a bunch of issues here. This also resolves the issue of binding to non-local address. The fix is still in our dev branch, but should soon hit the release branch. |
Just FYI that the IPV6_V6ONLY issue is fixed in 14936 (see release notes) |
Thx. I'm currently on a business trip and will return this weekend. I'll immediately test and close this issue. |
Sorry, still can't close this: WSL now outputs
bind() to non-local IP address now returrns an error which is good but this should be EADDRNOTAVAIL. Instead WSL returns EINVAL. |
@christoh - Thanks much for validating this and the report. This has already been fixed in a subsequent check-in, but that change has not made it to the release branch yet. |
Good news. Will close asap when it gets into the insider preview |
Works in 14942 |
If you use bind() with an invalid IP address, the call succeeds under WSL (as opposed to Linux). Maybe related to #395 but is a different problem.
bindtest.zip (contains a single file bindtest.c):
Output on Linux:
Output on WSL:
The text was updated successfully, but these errors were encountered: