From 977e6c08fe06b224dade618d01cb7e2d9ebb387f Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Fri, 4 Apr 2003 11:09:08 +0000 Subject: [PATCH] Set link-local address of tun interface with prefixlen = 64 instead of 128. It makes RA happy. Reported by: rafa@dif.um.es, SHIRASAKI Yasuhiro Reviewed by: SHIRASAKI Yasuhiro MFC after: 1 week --- usr.sbin/ppp/iface.c | 14 +++++++------- usr.sbin/ppp/ipv6cp.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.sbin/ppp/iface.c b/usr.sbin/ppp/iface.c index e29bf751174..8a23742a25f 100644 --- a/usr.sbin/ppp/iface.c +++ b/usr.sbin/ppp/iface.c @@ -83,6 +83,10 @@ #include "prompt.h" #include "iface.h" +#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} +static const struct in6_addr in6mask128 = IN6MASK128; + struct iface * iface_Create(const char *name) @@ -333,7 +337,8 @@ iface_addr_Add(const char *name, struct iface_addr *addr, int s) memcpy(&ifra6.ifra_prefixmask, &ssmsk, sizeof ifra6.ifra_prefixmask); if (ncpaddr_family(&addr->peer) == AF_UNSPEC) ifra6.ifra_dstaddr.sin6_family = AF_UNSPEC; - else + else if (memcmp(&((struct sockaddr_in6 *)&ssmsk)->sin6_addr, &in6mask128, + sizeof in6mask128) == 0) memcpy(&ifra6.ifra_dstaddr, &sspeer, sizeof ifra6.ifra_dstaddr); ifra6.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; ifra6.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; @@ -426,7 +431,7 @@ int iface_Add(struct iface *iface, struct ncp *ncp, const struct ncprange *ifa, const struct ncpaddr *peer, int how) { - int af, n, removed, s, width; + int af, n, removed, s; struct ncpaddr ncplocal; struct iface_addr *addr, newaddr; @@ -452,11 +457,6 @@ iface_Add(struct iface *iface, struct ncp *ncp, const struct ncprange *ifa, return 1; /* Already there */ } - width = -#ifndef NOINET6 - (af == AF_INET6) ? 128 : -#endif - 32; removed = iface_addr_Zap(iface->name, iface->addr + n, s); if (removed) ncp_IfaceAddrDeleted(ncp, iface->addr + n); diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c index 02c30bf5d03..b126b0d078f 100644 --- a/usr.sbin/ppp/ipv6cp.c +++ b/usr.sbin/ppp/ipv6cp.c @@ -224,7 +224,7 @@ ipcp_SetIPv6address(struct ipv6cp *ipv6cp, u_char *myifid, u_char *hisifid) ncpaddr_setip6(&ipv6cp->myaddr, &myaddr); ncpaddr_setip6(&ipv6cp->hisaddr, &hisaddr); - ncprange_sethost(&myrange, &ipv6cp->myaddr); + ncprange_set(&myrange, &ipv6cp->myaddr, 64); if (!iface_Add(bundle->iface, &bundle->ncp, &myrange, &ipv6cp->hisaddr, IFACE_ADD_FIRST|IFACE_FORCE_ADD|IFACE_SYSTEM))