Conversation
The copy of `Ipv6Addr::multicast_scope` used by `only_global_ips` misses the `is_multicast()` check that std has, so it looked at the low nibble of the first segment of every IPv6 address. Unicast addresses like 2001:4860:: or 2a01:4f8:: were classified as local scope and dropped, and ULAs like fd0e:: were classified as global.
Contributor
|
This pull request has merge conflicts. Could you please resolve them @Bruce039? 🙏 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GlobalIp for Ipv6Addrin autonat v1 has a local copy of the unstableIpv6Addr::multicast_scope, but it leaves out theis_multicast()check that std does first. Because of that the scope nibble is read from every address, not only fromff00::/8. A unicast address whose first segment ends in 1-5 or 8 (2001:4860::, 2a01:4f8::, 2003:e0::, 2601::, ...) is reported as local scope, so withonly_global_ips(on by default) the server refuses such clients and the client ignores such servers. It also goes the other way: a ULA like fd0e::1 ends ineand is treated as global.The fix returns
Nonefor non-multicast addresses so they fall through tois_unicast_global, which is what the std version does. I added a small test with a few real global addresses and the usual non-global ranges; on master it fails on2001:4860:4860::8888.autonat 0.16.0 is already released, so this bumps the crate to 0.16.1.