diff options
author | itojun <itojun@FreeBSD.org> | 2000-08-14 04:54:58 +0000 |
---|---|---|
committer | itojun <itojun@FreeBSD.org> | 2000-08-14 04:54:58 +0000 |
commit | cd0197dbb98f8e6e89a00bbf30723cb77c4ac9a0 (patch) | |
tree | e4a23d9bb17c38a06152faf9799e3ff4ef03e9ff | |
parent | 7c555f995ffc316fde3f584e25695c6e0547f154 (diff) | |
download | FreeBSD-src-cd0197dbb98f8e6e89a00bbf30723cb77c4ac9a0.zip FreeBSD-src-cd0197dbb98f8e6e89a00bbf30723cb77c4ac9a0.tar.gz |
fix LP64 issue in routing socket manipulation.
make behavior of -A safer.
(sync with kame)
-rw-r--r-- | usr.sbin/route6d/route6d.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 40788f6..102c1ff 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $KAME: route6d.c,v 1.30 2000/06/04 06:48:03 itojun Exp $ */ +/* $KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -31,7 +31,7 @@ */ #ifndef lint -static char _rcsid[] = "$KAME: route6d.c,v 1.30 2000/06/04 06:48:03 itojun Exp $"; +static char _rcsid[] = "$KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $"; #endif #include <stdio.h> @@ -2251,7 +2251,7 @@ rt_entry(rtm, again) if ((rtm->rtm_addrs & RTA_DST) == 0) return; /* ignore routes without destination address */ sin6_dst = (struct sockaddr_in6 *)rtmp; - rtmp += sin6_dst->sin6_len; + rtmp += ROUNDUP(sin6_dst->sin6_len); if (rtm->rtm_addrs & RTA_GATEWAY) { sin6_gw = (struct sockaddr_in6 *)rtmp; rtmp += ROUNDUP(sin6_gw->sin6_len); @@ -2724,7 +2724,9 @@ filterconfig() struct iff ftmp, *iff_obj; struct ifc *ifcp; struct riprt *rrt; +#if 0 struct in6_addr gw; +#endif for (i = 0; i < nfilter; i++) { ap = filter[i]; @@ -2783,6 +2785,24 @@ ifonly: rrt->rrt_rflags = RRTF_AGGREGATE; rrt->rrt_t = 0; rrt->rrt_index = loopifindex; +#if 0 + if (getroute(&rrt->rrt_info, &gw)) { +#if 0 + /* + * When the address has already been registered in the + * kernel routing table, it should be removed + */ + delroute(&rrt->rrt_info, &gw); +#else + /* it is more safe behavior */ + errno = EINVAL; + fatal("%s/%u already in routing table, " + "cannot aggregate", + inet6_n2p(&rrt->rrt_info.rip6_dest), + rrt->rrt_info.rip6_plen); +#endif + } +#endif /* Put the route to the list */ rrt->rrt_next = riprt; riprt = rrt; @@ -2792,13 +2812,6 @@ ifonly: /* Add this route to the kernel */ if (nflag) /* do not modify kernel routing table */ continue; - if (getroute(&rrt->rrt_info, &gw)) { - /* - * When the address has already been registered in the - * kernel routing table, it should be removed - */ - delroute(&rrt->rrt_info, &gw); - } addroute(rrt, &in6addr_loopback, loopifcp); } } |