diff options
author | Rainer Giedat <rainer@cvs.openbsd.org> | 2009-01-30 11:57:00 +0000 |
---|---|---|
committer | Rainer Giedat <rainer@cvs.openbsd.org> | 2009-01-30 11:57:00 +0000 |
commit | 23c1ba731bf4346883cd4a78ad038353f05eeaf6 (patch) | |
tree | 7cb4757a9c928c9fc7d04623b2a0ac0538807527 /sys | |
parent | a9c9dbe15c7561168bb5d3b3aa0aed838b10e3b7 (diff) |
Mark routers internal as uninstalled after deleting the default route.
This makes it possible to get a new default route by router advertisement
after the old one got deleted (or timed out).
Ok henning@, claudio@, mcbride@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/nd6.c | 13 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 5 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 9c62a91ea1d..ae523e08db8 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.81 2008/10/15 19:12:18 blambert Exp $ */ +/* $OpenBSD: nd6.c,v 1.82 2009/01/30 11:56:59 rainer Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -995,7 +995,18 @@ nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; struct ifnet *ifp = rt->rt_ifp; struct ifaddr *ifa; + struct nd_defrouter *dr; + if (req == RTM_DELETE && (rt->rt_flags & RTF_GATEWAY) && + (IN6_ARE_ADDR_EQUAL(&(satosin6(rt_key(rt)))->sin6_addr, + &in6addr_any) && rt_mask(rt) && (rt_mask(rt)->sa_len == 0 || + IN6_ARE_ADDR_EQUAL(&(satosin6(rt_mask(rt)))->sin6_addr, + &in6addr_any)))) { + dr = defrouter_lookup(&SIN6(gate)->sin6_addr, ifp); + if (dr) + dr->installed = 0; + } + if ((rt->rt_flags & RTF_GATEWAY) != 0) return; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 80e4160f464..1158ff2f0c6 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.49 2009/01/30 10:47:46 mcbride Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.50 2009/01/30 11:56:59 rainer Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -758,6 +758,9 @@ defrtrlist_update(struct nd_defrouter *new) dr->rtlifetime = new->rtlifetime; dr->expire = new->expire; + if (!dr->installed) + defrouter_select(); + /* * If the preference does not change, there's no need * to sort the entries. |