Issue Details

Number
28061
Title
Auto detect IPv6 connectivity
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)`: https://github.com/bitcoin/bitcoin/blob/79e8247ddb166f9b980f40249b7372a502402a4d/src/netbase.cpp#L462 should return `EAFNOSUPPORT`. Or if the kernel has support, but the error from `connect(2)`: https://github.com/bitcoin/bitcoin/blob/79e8247ddb166f9b980f40249b7372a502402a4d/src/netbase.cpp#L527 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 https://github.com/bitcoin/bitcoin/pull/27213#pullrequestreview-1516531774
URL
https://github.com/bitcoin/bitcoin/issue/28061
Closed by
Back to List