X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fpackets.c;h=57291674ac5db6ce38d6bb0379e93dc2560f994c;hb=e615b0a347057f9af7e93922acd4ae794ac87015;hp=833074cc5fc863f582929a88916d1de453c79be0;hpb=c08201d6645520f384bbfee3b490b99af8f2c149;p=openvswitch diff --git a/lib/packets.c b/lib/packets.c index 833074cc..57291674 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -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;