mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
Allow general masking of IPv6 addresses rather than just CIDR masks.
OF1.2 and later make these fields fully maskable so we might as well also. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -350,7 +350,10 @@ ipv6_create_mask(int mask)
|
||||
|
||||
/* Given the IPv6 netmask 'netmask', returns the number of bits of the IPv6
|
||||
* address that it specifies, that is, the number of 1-bits in 'netmask'.
|
||||
* 'netmask' must be a CIDR netmask (see ipv6_is_cidr()). */
|
||||
* 'netmask' must be a CIDR netmask (see ipv6_is_cidr()).
|
||||
*
|
||||
* If 'netmask' is not a CIDR netmask (see ipv6_is_cidr()), the return value
|
||||
* will still be in the valid range but isn't otherwise meaningful. */
|
||||
int
|
||||
ipv6_count_cidr_bits(const struct in6_addr *netmask)
|
||||
{
|
||||
@@ -358,8 +361,6 @@ ipv6_count_cidr_bits(const struct in6_addr *netmask)
|
||||
int count = 0;
|
||||
const uint8_t *netmaskp = &netmask->s6_addr[0];
|
||||
|
||||
assert(ipv6_is_cidr(netmask));
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
if (netmaskp[i] == 0xff) {
|
||||
count += 8;
|
||||
|
Reference in New Issue
Block a user