aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/route6d/route6d.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@FreeBSD.org>2000-08-14 04:54:58 +0000
committerJun-ichiro itojun Hagino <itojun@FreeBSD.org>2000-08-14 04:54:58 +0000
commit7ec2457fd9c636821e81c3857be256253b61c2a7 (patch)
treee7879db001815194a18995d305f1b32f8010405a /usr.sbin/route6d/route6d.c
parent8f4fec9c364ce67beba2a2ab4c63bbf1a09182c5 (diff)
downloadsrc-7ec2457fd9c636821e81c3857be256253b61c2a7.tar.gz
src-7ec2457fd9c636821e81c3857be256253b61c2a7.zip
fix LP64 issue in routing socket manipulation.
make behavior of -A safer. (sync with kame)
Notes
Notes: svn path=/head/; revision=64631
Diffstat (limited to 'usr.sbin/route6d/route6d.c')
-rw-r--r--usr.sbin/route6d/route6d.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 40788f6ffb16..102c1ffc0fbf 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);
}
}