diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-08 00:06:59 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-08 00:06:59 +0000 |
commit | b35ff1ae08a7fe569897241947182407873a92e8 (patch) | |
tree | f01f04bee59b051fdc760bd8cdf826f90a471984 | |
parent | 698e8b0820f983e14323608284b9bec2f5dd339e (diff) |
in6_len2mask is a duplicate of in6_prefixlen2mask. unify. sync w/kame
-rw-r--r-- | sys/netinet6/in6.c | 22 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 3 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 4 |
3 files changed, 7 insertions, 22 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 5e1110c107d..d2bfe420ee7 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.40 2002/06/08 00:00:59 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.41 2002/06/08 00:06:58 itojun Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -280,20 +280,6 @@ in6_mask2len(mask) return x * 8 + y; } -void -in6_len2mask(mask, len) - struct in6_addr *mask; - int len; -{ - int i; - - bzero(mask, sizeof(*mask)); - for (i = 0; i < len / 8; i++) - mask->s6_addr8[i] = 0xff; - if (len % 8) - mask->s6_addr8[i] = (0xff00 >> (len % 8)) & 0xff; -} - #define ifa2ia6(ifa) ((struct in6_ifaddr *)(ifa)) #define ia62ifa(ia6) (&((ia6)->ia_ifa)) @@ -928,7 +914,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) ifra.ifra_prefixmask.sin6_family = AF_INET6; ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - in6_len2mask(&ifra.ifra_prefixmask.sin6_addr, prefixlen); + in6_prefixlen2mask(&ifra.ifra_prefixmask.sin6_addr, prefixlen); ifra.ifra_flags = iflr->flags & ~IFLR_PREFIX; return in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, @@ -945,7 +931,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) bzero(&mask, sizeof(mask)); if (iflr->flags & IFLR_PREFIX) { /* lookup a prefix rather than address. */ - in6_len2mask(&mask, iflr->prefixlen); + in6_prefixlen2mask(&mask, iflr->prefixlen); sin6 = (struct sockaddr_in6 *)&iflr->addr; bcopy(&sin6->sin6_addr, &match, sizeof(match)); @@ -965,7 +951,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) cmp = 0; /*XXX*/ } else { /* on deleting an address, do exact match */ - in6_len2mask(&mask, 128); + in6_prefixlen2mask(&mask, 128); sin6 = (struct sockaddr_in6 *)&iflr->addr; bcopy(&sin6->sin6_addr, &match, sizeof(match)); diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 22266b218a6..71aa8830f4c 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.18 2002/06/07 15:00:55 itojun Exp $ */ +/* $OpenBSD: in6_var.h,v 1.19 2002/06/08 00:06:58 itojun Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -564,7 +564,6 @@ int in6_leavegroup(struct in6_multi_mship *); void in6_ifscrub(struct ifnet *, struct in6_ifaddr *); int in6_ifindex2scopeid(int); int in6_mask2len(struct in6_addr *); -void in6_len2mask(struct in6_addr *, int); int in6_control(struct socket *, u_long, caddr_t, struct ifnet *, struct proc *); void in6_purgeaddr(struct ifaddr *, struct ifnet *); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index ad9f629a52f..db6da5fb51e 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.15 2002/06/07 03:06:15 itojun Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.16 2002/06/08 00:06:58 itojun Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -1210,7 +1210,7 @@ in6_ifadd(ifp, in6, addr, prefixlen) int s, error; struct in6_addr mask; - in6_len2mask(&mask, prefixlen); + in6_prefixlen2mask(&mask, prefixlen); /* find link-local address (will be interface ID) */ ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0);/* 0 is OK? */ |