2
0
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:
Ben Pfaff
2012-05-22 22:49:31 -07:00
parent c08201d664
commit ff0b06eef1
7 changed files with 42 additions and 25 deletions

View File

@@ -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;