diff options
author | brian <brian@cvs.openbsd.org> | 2001-11-23 12:38:53 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2001-11-23 12:38:53 +0000 |
commit | 1f9ab14a0611a738ff17c91ff63baea4759d09b5 (patch) | |
tree | ba31ec3a6cb39f29881d7cdddc02f98dac08e23e /usr.sbin | |
parent | 4c4d11b2e44508d270673757525de376eb9f7520 (diff) |
Don't adjust_linklocal() when pulling a sockaddr out of an ncpaddr or
ncprange structure.
Don't write() the netmask for IPv6 sockaddrs to the routing socket if
the prefixlen is 128.
It seems that messages written to the routing socket with the scopeid
set for link local addresses are not understood. Instead, we have to
put the scopeid in the 5th and 6th bytes of the address (see
adjust_linklocal() in ncpaddr.c). I think this may be a bug in the
KAME implementation - it should really understand both forms.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/ncpaddr.c | 17 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ncpaddr.h | 1 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/route.c | 12 |
3 files changed, 19 insertions, 11 deletions
diff --git a/usr.sbin/ppp/ppp/ncpaddr.c b/usr.sbin/ppp/ppp/ncpaddr.c index 64a917d1da1..aa99bda11b5 100644 --- a/usr.sbin/ppp/ppp/ncpaddr.c +++ b/usr.sbin/ppp/ppp/ncpaddr.c @@ -324,7 +324,6 @@ ncpaddr_getsa(const struct ncpaddr *addr, struct sockaddr_storage *host) host6->sin6_family = AF_INET6; host6->sin6_len = sizeof(*host6); host6->sin6_addr = addr->ncpaddr_ip6addr; - adjust_linklocal(host6); break; #endif @@ -610,6 +609,21 @@ ncprange_sethost(struct ncprange *range, const struct ncpaddr *from) } int +ncprange_ishost(const struct ncprange *range) +{ + switch (range->ncprange_family) { + case AF_INET: + return range->ncprange_ip4width == 32; +#ifndef NOINET6 + case AF_INET6: + return range->ncprange_ip6width == 128; +#endif + } + + return (0); +} + +int ncprange_setwidth(struct ncprange *range, int width) { switch (range->ncprange_family) { @@ -733,7 +747,6 @@ ncprange_getsa(const struct ncprange *range, struct sockaddr_storage *host, host6->sin6_family = AF_INET6; host6->sin6_len = sizeof(*host6); host6->sin6_addr = range->ncprange_ip6addr; - adjust_linklocal(host6); if (mask6) { mask6->sin6_family = AF_INET6; mask6->sin6_len = sizeof(*host6); diff --git a/usr.sbin/ppp/ppp/ncpaddr.h b/usr.sbin/ppp/ppp/ncpaddr.h index 2b3c5466191..8c6b8861232 100644 --- a/usr.sbin/ppp/ppp/ncpaddr.h +++ b/usr.sbin/ppp/ppp/ncpaddr.h @@ -86,6 +86,7 @@ extern int ncprange_containsip4(const struct ncprange *, struct in_addr); extern void ncprange_copy(struct ncprange *, const struct ncprange *); extern void ncprange_set(struct ncprange *, const struct ncpaddr *, int); extern void ncprange_sethost(struct ncprange *, const struct ncpaddr *); +extern int ncprange_ishost(const struct ncprange *); extern int ncprange_setwidth(struct ncprange *, int); extern void ncprange_setip4(struct ncprange *, struct in_addr, struct in_addr); extern void ncprange_setip4host(struct ncprange *, struct in_addr); diff --git a/usr.sbin/ppp/ppp/route.c b/usr.sbin/ppp/ppp/route.c index dbf1d7428ed..b23f5a37004 100644 --- a/usr.sbin/ppp/ppp/route.c +++ b/usr.sbin/ppp/ppp/route.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: route.c,v 1.17 2001/09/04 22:12:46 brian Exp $ + * $OpenBSD: route.c,v 1.18 2001/11/23 12:38:52 brian Exp $ */ #include <sys/param.h> @@ -698,7 +698,7 @@ rt_Set(struct bundle *bundle, int cmd, const struct ncprange *dst, const struct ncpaddr *gw, int bang, int quiet) { struct rtmsg rtmes; - int domask, s, nb, wb, width; + int s, nb, wb, width; char *cp; const char *cmdstr; struct sockaddr_storage sadst, samask, sagw; @@ -757,13 +757,7 @@ rt_Set(struct bundle *bundle, int cmd, const struct ncprange *dst, } } - domask = 1; - if (ncprange_family(dst) == AF_INET) { - ncprange_getwidth(dst, &width); - if (width == 32) - domask = 0; - } - if (domask) { + if (!ncprange_ishost(dst)) { memcpy(cp, &samask, samask.ss_len); cp += samask.ss_len; rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; |