Closed DinoStray closed 4 years ago
That's a good point, this feature doesn't currently exist, probably because no one has asked for it 😄
Would you consider adding it?
@DinoStray please let me know if you'd consider implementing this feature
@DinoStray please let me know if you'd consider implementing this feature
Sorry, I go out for a weekend trip.
OK, pleasure with that.
But first of all, maybe I should learn more about ipv6
Thanks, I really appreciate your help!
You can read about IPv6 subnet mask here: https://tools.ietf.org/id/draft-lubashev-ipv6-addr-mask-01.html https://docs.netgate.com/pfsense/en/latest/book/network/ipv6-subnets.html
hi @DinoStray , any progress on that?
Sorry it took me some time to understand some concepts.
For IPv4, we need subnet mask.
so the method should be:
bool matchSubnet(const IPv4Address& subnet, const IPv4Address& subnetMask) const;
But for IPv6, we only need prefix length.
so the method should be:
bool matchSubnet(const IPv6Address& subnet, uint8_t prefixLength) const;
Am I right? @seladb
Yes, that's correct. The prefixLength
tells how many bytes to use in the mask
I committed a PR for this issue
Thanks! please take a look at my PR comments
I committed a new PR following your comments.
For ipv4 address, I can use matchSubnet() checks whether the address matches a subnet.
But for ipv6, how can I do this?
I also asked this question in :
https://stackoverflow.com/questions/62129703/for-lib-pcapplusplus-why-there-is-no-matchsubnet-for-ipv6-address