Closes #32433
MaybeFlipIPv6toCJDNS()
relies on g_reachable_nets
to distinguish between CJDNS addresses and other IPv6 addresses. In particular, RFC4193 address or “Unique Local Address” with the L-bit unset also begins with the fc
prefix. #32433 highlights a use case for these addresses that have nothing to do with CJDNS.
On master we don’t parse init flags like -cjdnsreachable
until after the HTTP server has started, causing conflicts with -rpcallowip
because CJDNS doesn’t support subnets.
This PR ensures that NET_CJDNS
is only present in the reachable networks list if set by -cjdnsreachable
before -rpcallowip
is checked. If it is set all fc
addresses are assumed to be CJDNS, can not have subnets, and can’t be set for -rpcallowip
.
I also noted this specific parameter interaction in the init help as well as the error message if configured incorrectly.
This can be tested locally:
bitcoind -regtest -rpcallowip=fc00:dead:beef::/64 -rpcuser=u -rpcpassword=p
On master this will just throw an error that doesn’t even mention IPv6 at all.
On the branch, this will succeed and can be tested by adding the ULA to a local interface.
On linux: sudo ip -6 addr add fc00:dead:beef::1/64 dev lo
On macos: sudo ifconfig lo0 inet6 fc00:dead:beef::1/128 add
then: curl -v -g -6 --interface fc00:dead:beef::1 u:p@[::1]:18443 --data '{"method":"getblockcount"}'
If the rpcallowip
option is removed, the RPC request will fail to authorize.
Finally, adding -cjdnsreachable
to the start up command will throw an error and specify the incompatibility:
RFC4193 is allowed only if -cjdnsreachable=0.