diff options
-rw-r--r-- | sys/net/if_spppsubr.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 28 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 3 |
3 files changed, 5 insertions, 32 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 599f9fcfc2d..045d4f4f627 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.171 2017/08/14 08:33:55 reyk Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.172 2017/08/15 06:08:52 florian Exp $ */ /* * Synchronous PPP link level subroutines. * @@ -4355,7 +4355,6 @@ sppp_update_ip6_addr(void *arg) struct sppp *sp = arg; struct ifnet *ifp = &sp->pp_if; struct in6_aliasreq *ifra = &sp->ipv6cp.req_ifid; - struct in6_addr mask = in6mask128; struct in6_ifaddr *ia6; int error; @@ -4386,7 +4385,8 @@ sppp_update_ip6_addr(void *arg) */ /* Destination address can only be set for /128. */ - if (!in6_are_prefix_equal(&ia6->ia_prefixmask.sin6_addr, &mask, 128)) { + if (memcmp(&ia6->ia_prefixmask.sin6_addr, &in6mask128, + sizeof(in6mask128)) != 0) { ifra->ifra_dstaddr.sin6_len = 0; ifra->ifra_dstaddr.sin6_family = AF_UNSPEC; } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index b83e6df6c66..a51374d8c11 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.210 2017/08/11 19:53:02 bluhm Exp $ */ +/* $OpenBSD: in6.c,v 1.211 2017/08/15 06:08:52 florian Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1519,32 +1519,6 @@ in6_matchlen(struct in6_addr *src, struct in6_addr *dst) return match; } -int -in6_are_prefix_equal(struct in6_addr *p1, struct in6_addr *p2, int len) -{ - int bytelen, bitlen; - - /* sanity check */ - if (0 > len || len > 128) { - log(LOG_ERR, "in6_are_prefix_equal: invalid prefix length(%d)\n", - len); - return (0); - } - - bytelen = len / 8; - bitlen = len % 8; - - 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)) - return (0); - - return (1); -} - void in6_prefixlen2mask(struct in6_addr *maskp, int len) { diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index a023d12a1bf..857dfcc3b2a 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.68 2017/08/06 08:15:58 florian Exp $ */ +/* $OpenBSD: in6_var.h,v 1.69 2017/08/15 06:08:52 florian Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -395,7 +395,6 @@ struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *); int in6_addr2scopeid(unsigned int, struct in6_addr *); int in6_matchlen(struct in6_addr *, struct in6_addr *); -int in6_are_prefix_equal(struct in6_addr *, struct in6_addr *, int); void in6_prefixlen2mask(struct in6_addr *, int); void in6_purgeprefix(struct ifnet *); #endif /* _KERNEL */ |