diff options
| author | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2004-09-14 10:02:20 +0900 |
|---|---|---|
| committer | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2004-09-14 10:02:20 +0900 |
| commit | a7761ad6d7dcfd7786ab2fd799228424d854ceb7 (patch) | |
| tree | b1d952a781883d9315903d12d17a81a700b1d0fe | |
| parent | 92d6b3d3c39db00426e0b4e7b9a9f38a80390842 (diff) | |
[IPV6] ensure to aging default routes.
This patch is product of corraboration with Ville Nuorvala
<vnuorval@tcs.hut.fi>.
Signed-off-by: Hideaki YOSHIFUJi <yoshfuji@linux-ipv6.org>
| -rw-r--r-- | net/ipv6/ip6_fib.c | 7 | ||||
| -rw-r--r-- | net/ipv6/route.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index ff6bd80f7b1b..8b3e6f5e3168 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -49,6 +49,9 @@ struct rt6_statistics rt6_stats; +extern struct rt6_info *rt6_dflt_pointer; +extern spinlock_t rt6_dflt_lock; + static kmem_cache_t * fib6_node_kmem; enum fib_walk_state_t @@ -1184,6 +1187,10 @@ static int fib6_age(struct rt6_info *rt, void *arg) if (rt->rt6i_flags&RTF_EXPIRES && rt->rt6i_expires) { if (time_after(now, rt->rt6i_expires)) { RT6_TRACE("expiring %p\n", rt); + spin_lock_bh(&rt6_dflt_lock); + if (rt == rt6_dflt_pointer) + rt6_dflt_pointer = NULL; + spin_unlock_bh(&rt6_dflt_lock); return -1; } gc_args.more++; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a8f9ed33e44d..805bc8ee9507 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -208,8 +208,8 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt, /* * pointer to the last default router chosen. BH is disabled locally. */ -static struct rt6_info *rt6_dflt_pointer; -static spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; +struct rt6_info *rt6_dflt_pointer; +spinlock_t rt6_dflt_lock = SPIN_LOCK_UNLOCKED; /* Default Router Selection (RFC 2461 6.3.6) */ static struct rt6_info *rt6_best_dflt(struct rt6_info *rt, int oif) @@ -227,7 +227,7 @@ static struct rt6_info *rt6_best_dflt(struct rt6_info *rt, int oif) sprt->rt6i_dev->ifindex == oif)) m += 8; - if (sprt->rt6i_expires && + if ((sprt->rt6i_flags & RTF_EXPIRES) && time_after(jiffies, sprt->rt6i_expires)) continue; @@ -1265,7 +1265,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, rtmsg.rtmsg_type = RTMSG_NEWROUTE; ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr); rtmsg.rtmsg_metric = 1024; - rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP; + rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES; rtmsg.rtmsg_ifindex = dev->ifindex; |
