-
Notifications
You must be signed in to change notification settings - Fork 38k
Description
Please describe the feature you'd like to see added.
Auto detect if the host has connectivity to the IPv6 network and only attempt to make automatic outbound connections if it has.
Is your feature related to a problem, if so please describe it.
IPv6 is set to reachable by default. If it is not in practice then some outbound connection attempts will be made in vain, trying to connect to IPv6 hosts.
Describe the solution you'd like
If the kernel does not have IPv6 support compiled in then socket(2)
:
Line 462 in 79e8247
SOCKET hSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP); |
should return EAFNOSUPPORT
.
Or if the kernel has support, but the error from connect(2)
:
Line 527 in 79e8247
if (sock.Connect(reinterpret_cast<struct sockaddr*>(&sockaddr), len) == SOCKET_ERROR) { |
is EADDRNOTAVAIL
then that means the machine has no IPv6 address configured (but it may be configured later).
In those cases, I guess, we can disable IPv6 with SetReachable(NET_IPV6, false)
or at least log a warning prompting the user to explicitly list all reachable networks with -onlynet
and omit IPv6 if it is not.
Describe any alternatives you've considered
A workaround would be to list all other networks on onlynet
, e.g. if there is connectivity to IPv4 and I2P, use -onlynet=ipv4 -onlynet=i2p
.
Please leave any additional context
Inspired by #27213 (review)