diff options
author | ume <ume@FreeBSD.org> | 2003-03-25 16:49:08 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2003-03-25 16:49:08 +0000 |
commit | 9285b790038b53cc8da52cf4c50042abc8bfa701 (patch) | |
tree | a815b92c7d314ebb072288a4964a7b42ab0c401e /usr.sbin/ppp | |
parent | 506e1c7087dccbfe1c8b00a5260b6a662ed2fa93 (diff) | |
download | FreeBSD-src-9285b790038b53cc8da52cf4c50042abc8bfa701.zip FreeBSD-src-9285b790038b53cc8da52cf4c50042abc8bfa701.tar.gz |
We need filling scopeid to install routes for link-local
scope addresses.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/route.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index 398bf69..168911c 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -708,6 +708,24 @@ memcpy_roundup(char *cp, const void *data, size_t len) return padlen; } +#if defined(__KAME__) && !defined(NOINET6) +static void +add_scope(struct sockaddr *sa, int ifindex) +{ + struct sockaddr_in6 *sa6; + + if (sa->sa_family != AF_INET6) + return; + sa6 = (struct sockaddr_in6 *)sa; + if (!IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr) && + !IN6_IS_ADDR_MC_LINKLOCAL(&sa6->sin6_addr)) + return; + if (*(u_int16_t *)&sa6->sin6_addr.s6_addr[2] != 0) + return; + *(u_int16_t *)&sa6->sin6_addr.s6_addr[2] = htons(ifindex); +} +#endif + int rt_Set(struct bundle *bundle, int cmd, const struct ncprange *dst, const struct ncpaddr *gw, int bang, int quiet) @@ -748,6 +766,9 @@ rt_Set(struct bundle *bundle, int cmd, const struct ncprange *dst, } ncprange_getsa(dst, &sadst, &samask); +#if defined(__KAME__) && !defined(NOINET6) + add_scope((struct sockaddr *)&sadst, bundle->iface->index); +#endif cp = rtmes.m_space; cp += memcpy_roundup(cp, &sadst, sadst.ss_len); @@ -758,6 +779,9 @@ rt_Set(struct bundle *bundle, int cmd, const struct ncprange *dst, return result; } ncpaddr_getsa(gw, &sagw); +#if defined(__KAME__) && !defined(NOINET6) + add_scope((struct sockaddr *)&sagw, bundle->iface->index); +#endif if (ncpaddr_isdefault(gw)) { if (!quiet) log_Printf(LogERROR, "rt_Set: Cannot add a route with" |