diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-03-08 03:24:58 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-03-08 03:24:58 +0000 |
commit | c133ffa9b430ff6130e9afcf1511f024b2c70afb (patch) | |
tree | cff406b7fc5e32a7f5cb6ba31fa19228768618d1 /usr.sbin | |
parent | 342ce63a610b55295932f8ea5d8be3a2bde63fac (diff) |
correct delroute() against host routes. clarify ROUTE6D p2p advert behavior
(no behavior change for normal use). sync with kame
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/route6d/route6d.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index bc66e7254cb..cb17b634e2f 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,5 +1,5 @@ -/* $OpenBSD: route6d.c,v 1.15 2001/02/07 13:52:23 itojun Exp $ */ -/* $KAME: route6d.c,v 1.58 2001/02/07 13:42:02 itojun Exp $ */ +/* $OpenBSD: route6d.c,v 1.16 2001/03/08 03:24:57 itojun Exp $ */ +/* $KAME: route6d.c,v 1.60 2001/03/08 02:15:42 onoe Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -31,7 +31,7 @@ */ #if 0 -static char _rcsid[] = "$OpenBSD: route6d.c,v 1.15 2001/02/07 13:52:23 itojun Exp $"; +static char _rcsid[] = "$OpenBSD: route6d.c,v 1.16 2001/03/08 03:24:57 itojun Exp $"; #endif #include <stdio.h> @@ -2084,6 +2084,10 @@ ifrt_p2p(ifcp, again) * do not install network route to route6d routing * table (if we do, it would prevent route installation * for other p2p interface that shares addr/plen). + * + * XXX what should we do if dest is ::? it will not + * get announced anyways (see following filter), + * but we need to think. */ advert |= P2PADVERT_ADDR; advert |= P2PADVERT_DEST; @@ -2091,15 +2095,29 @@ ifrt_p2p(ifcp, again) break; case ROUTE6D: /* - * just for testing... + * just for testing. actually the code is redundant + * given the current p2p interface address assignment + * rule for kame kernel. + * + * intent: + * A/n -> announce A/n + * A B/n, A and B share prefix -> A/n (= B/n) + * A B/n, do not share prefix -> A/128 and B/128 + * actually, A/64 and A B/128 are the only cases + * permitted by the kernel: + * A/64 -> A/64 + * A B/128 -> A/128 and B/128 */ - if (IN6_ARE_ADDR_EQUAL(&addr, &dest)) + if (!IN6_IS_ADDR_UNSPECIFIED(&ifa->ifa_raddr)) { + if (IN6_ARE_ADDR_EQUAL(&addr, &dest)) + advert |= P2PADVERT_NETWORK; + else { + advert |= P2PADVERT_ADDR; + advert |= P2PADVERT_DEST; + ignore |= P2PADVERT_NETWORK; + } + } else advert |= P2PADVERT_NETWORK; - else { - advert |= P2PADVERT_ADDR; - advert |= P2PADVERT_DEST; - ignore |= P2PADVERT_NETWORK; - } break; } @@ -2673,6 +2691,8 @@ delroute(np, gw) rtm->rtm_seq = ++seq; rtm->rtm_pid = pid; rtm->rtm_flags = RTF_UP | RTF_GATEWAY; + if (np->rip6_plen == sizeof(struct in6_addr) * 8) + rtm->rtm_flags |= RTF_HOST; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; sin = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; /* Destination */ |