-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Net: Add IPv6 Link-Local Address Support #7570
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
Conversation
Potential nit, haven't looked at the code in detail: by their local nature there's no way that scoped addresses can work in the P2P address advertising logic - so from a privacy angle, does this make sure that these can't leak to the P2P network? |
For the link-local addresses I believe that is accounted for already because CNetAddr::IsRFC4862 matches them and thus CNetAddr::IsRoutable returns false for them. About the site-local category of scoped addresses, upon more investigation, their usage is already deprecated by RFC 3879 (https://www.ietf.org/rfc/rfc3879.txt) and Linux does not support them. I only mentioned them because the Windows documents mentioned them and I'm inclined to think that we don't need to concern ourselves with them. If we do, then we could maybe add another method to match them and then make that part of the IsRoutable check too. |
57ae377
to
70add6c
Compare
Concept ACK |
I rebased and re-worked this commit to make it easier to review. Also, circling back on the site-local addresses...
That's good. It means this PR only has to concern itself with link-local (which was the original intent). The link-local The motivation for this change is to make it easier to deploy and manage a cluster of nodes on a local network. |
Thanks for the explanation. I was indeed curious what one would use this for in practice. utACK eda3d92 |
utACK eda3d92 |
eda3d92 Net: Add IPv6 Link-Local Address Support (mruddy)
eda3d92 Net: Add IPv6 Link-Local Address Support (mruddy)
Adds support for binding and listening, as well as connecting to, scoped IPv6 addresses.
I wanted to be able to use IPv6 link-local addresses on 4.2+ GNU/Linux (
sin6_scope_id
was added in 2.4). So, that's what I've tested. It seems to work. If I missed something, please let me know and I'll fix it.I haven't tried with Windows or Mac, but I think the support is present in many versions of those systems too.
Hopefully, this does not simply fail for the automated Windows build (fingers crossed).
IPv6 scoped addresses are also known as link-local and site-local addresses.
The Linux docs say, "Linux supports it [sin6_scope_id] only for link-local addresses". Windows may support site-local addresses.
Note that if you test this, it's easier to see the bound address with something like:
sudo netstat -pantu --wide | grep bitcoin
Also, here's an example of an easy way to find nodes accessible on your local link:
ping6 -I eth0 -n ff02::1
Basically, commands similar to these should work now, instead of failing with
"Unable to bind to [fe80::1234:5ff:fe67:89ab]:8333 on this computer (bind returned error Invalid argument (22))"
or"socket send error Broken pipe (32)"
:bitcoin-qt/bitcoind -listen -bind/-whitebind='[fe80::1234:5ff:fe67:89ab%eth0]:8333'
bitcoin-qt/bitcoind -connect='[fe80::1234:5ff:fe67:89ab%eth0]:8333'
This should still fail due to missing the scope ID:
bitcoin-qt/bitcoind -listen -bind/-whitebind='[fe80::1234:5ff:fe67:89ab]:8333'
This should still fail due to the scope id being misplaced:
bitcoin-qt/bitcoind -listen -bind/-whitebind='[fe80::1234:5ff:fe67:89ab]%eth0:8333'
References:
http://man7.org/linux/man-pages/man7/ipv6.7.html
http://research.microsoft.com/en-us/um/redmond/projects/msripv6/docs/config.htm
https://msdn.microsoft.com/en-us/library/windows/desktop/ms739166(v=vs.85).aspx
https://tools.ietf.org/html/draft-ietf-ipv6-scope-api-00