diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-08-24 02:57:34 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-08-24 02:57:34 +0000 |
commit | 6d2d67a63eccdcd071066cc14cce0215ddfcb042 (patch) | |
tree | 08da9f5a6c5d528718e86c40114ff5c7cf43eea5 /sys | |
parent | ba59ab4994ea82537215ede6dc8bafe31a09fa7f (diff) |
revert. itojun notes that 128 is ok because of bitlen check.
add a comment to this effect since many of us were confused.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/in6.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 10373057a37..0d02c07eae9 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.58 2004/08/21 06:57:50 tedu Exp $ */ +/* $OpenBSD: in6.c,v 1.59 2004/08/24 02:57:33 tedu Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -2190,7 +2190,7 @@ in6_are_prefix_equal(p1, p2, len) int bytelen, bitlen; /* sanity check */ - if (0 > len || len >= 128) { + if (0 > len || len > 128) { log(LOG_ERR, "in6_are_prefix_equal: invalid prefix length(%d)\n", len); return (0); @@ -2201,6 +2201,7 @@ in6_are_prefix_equal(p1, p2, len) if (bcmp(&p1->s6_addr, &p2->s6_addr, bytelen)) return (0); + /* len == 128 is ok because bitlen == 0 then */ if (bitlen != 0 && p1->s6_addr[bytelen] >> (8 - bitlen) != p2->s6_addr[bytelen] >> (8 - bitlen)) @@ -2218,7 +2219,7 @@ in6_prefixlen2mask(maskp, len) int bytelen, bitlen, i; /* sanity check */ - if (0 > len || len >= 128) { + if (0 > len || len > 128) { log(LOG_ERR, "in6_prefixlen2mask: invalid prefix length(%d)\n", len); return; @@ -2229,6 +2230,7 @@ in6_prefixlen2mask(maskp, len) bitlen = len % 8; for (i = 0; i < bytelen; i++) maskp->s6_addr[i] = 0xff; + /* len == 128 is ok because bitlen == 0 then */ if (bitlen) maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; } |