-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
net: node on Linux allows opening a connection to 0.0.0.0
/::
while on Windows it doesn't
#14900
Comments
See #7291 (comment), basically using Lines 169 to 183 in 9ecc440
The ideal solution would be to fix Bunch of related Issues/PRs: |
BTW, that doesn't sound right: I suspect that 'any' on Windows doesn't include localhost, whereas it does on Linux. |
That makes more sense, so why does Linux allow |
After @bnoordhuis's comment I feel like the disparity is deeper than just test cases. |
0.0.0.0
/::
while on Windows it doesn't
This isn't something for node to solve though. I can tweak routing rules on Linux to exclude Node papers over platform differences when it's feasible and makes sense but that isn't the case here. |
Seems like on Windows it's always EADDRNOTAVAIL same as port 0 on POSIX: D:\code$ ROUTE ADD 0.0.0.0 MASK 255.255.255.255 0.0.0.0 METRIC 1 IF 1
OK!
D:\code$ ping 0.0.0.0
Pinging 0.0.0.0 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
D:\code$ ROUTE print 0.0.0.0
IPv4 Route Table
=====================================================================Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.127 25
0.0.0.0 0.0.0.0 192.168.1.1 192.168.0.112 45
0.0.0.0 255.255.255.255 On-link 127.0.0.1 76
===================================================================== So IMHO this disparity needs to be addressed at least with a note in the documentation. *Note*: Attempting to connect to port 0 will err with `EADDRNOTAVAIL`.
On Windows attempting to connect to address 0 (`'0.0.0.0'` or `'[::]'`) will cause the same error. |
Fixed in libuv 1.19.0 (libuv/libuv@2b32e77) |
Related issue in Node: nodejs/node#14900
master
Refs: #14865
Refs: #14111
Linux converts the ipv6 address "::" to "::1", while windows does not.
This makes
server.address().address
useless [as a target address] when bound toIPv6 localhost0.0.0.0
or::
on Windows.[addition]
Specifically the use of
server.address().address
for initiating new connection:While apparently Linux does allow opening a connection to the
::
unspecified addressThe text was updated successfully, but these errors were encountered: