ip-address: Add ipv6_ip_matches #6
Merged
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.
This function takes two arguments, an IPv6 address and a prefix with length, and checks that this address is, in fact, in this prefix.
We also add a hopefully complete enough set of tests.
It has analogous semantics to
ipv4_ip_subnet; the name is different because the word "subnet" does not really fit to universally describe an address range with common leading bits; many prefixes can be used to number a single subnet, a prefix might not correspond to a particular subnet at all (esp. with DHCP Prefix Delegation), etc. There's a short note on that in the doc page.