-
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
ipv6only listen option #17664
Comments
+1, we should have something like |
Putting it on |
This makes sense on the net side, but do we need this on the dgram side? On my machine at least, I seem unable to bind a |
Yes, seems that's not possible, I get a "bind EINVAL" when attempting this, so it seems for UDP, the bound address family is dictated by the type of socket and the issue only applies to |
For TCP servers, the dual-stack support is enable by default, i.e. binding host "::" will also make "0.0.0.0" bound. This commit add ipv6Only option in `net.Server.listen()` and `dgram.createSocket()` methods which allows to disable dual-stack support. Support for cluster module is also provided in this commit. Fixes: nodejs#17664
For TCP servers, the dual-stack support is enable by default, i.e. binding host "::" will also make "0.0.0.0" bound. This commit add ipv6Only option in `net.Server.listen()` and `dgram.createSocket()` methods which allows to disable dual-stack support. Support for cluster module is also provided in this commit. Fixes: #17664 PR-URL: #23798 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
For TCP servers, the dual-stack support is enable by default, i.e. binding host "::" will also make "0.0.0.0" bound. This commit add ipv6Only option in `net.Server.listen()` and `dgram.createSocket()` methods which allows to disable dual-stack support. Support for cluster module is also provided in this commit. Fixes: #17664 PR-URL: #23798 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
For TCP servers, the dual-stack support is enable by default, i.e. binding host "::" will also make "0.0.0.0" bound. This commit add ipv6Only option in `net.Server.listen()` and `dgram.createSocket()` methods which allows to disable dual-stack support. Support for cluster module is also provided in this commit. Fixes: nodejs#17664 PR-URL: nodejs#23798 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, listening on the
::
address will attempt to bind on IPv4 and IPv6, whatever is available. This works most of the time but a issue arises on Linux with theipv6.disable=1
kernel option set (which can be default on certain NAS devices). With it, listening on::
results in aEAFNOSUPPORT
error. To work around and still get a IPv4 socket, one would have to apply one of these workarounds:::
, catch theEAFNOSUPPORT
error and listen again on0.0.0.0
on error.::
and0.0.0.0
and ignore both theEAFNOSUPPORT
(can happen on::
) andEADDRINUSE
(happens on the latter call when dual-stack actually works) errors.To resolve above ugly error handling, I suggest exposing the existing
UV_{TCP,UDP}_IPV6ONLY
flags onserver#listen
andsocket#bind
via a new boolean optionipv6only
. With the option set, one can listen on::
and0.0.0.0
without any unexpected errors happening.Related: nginx also features the
ipv6only
option, which has been enabled by default since v1.3.4.The text was updated successfully, but these errors were encountered: