diff options
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 6c389300f4e9..87f04f372ae4 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1957,26 +1957,25 @@ struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr, return rt6_get_dflt_router(gwaddr, dev); } + void rt6_purge_dflt_routers(struct net *net) { struct rt6_info *rt; struct fib6_table *table; - - /* NOTE: Keep consistent with rt6_get_dflt_router */ table = fib6_get_table(net, RT6_TABLE_DFLT); if (!table) return; - restart: read_lock_bh(&table->tb6_lock); for (rt = table->tb6_root.leaf; rt; rt = rt->dst.rt6_next) { - if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF) && + if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF) && (!rt->rt6i_idev || rt->rt6i_idev->cnf.accept_ra != 2)) { dst_hold(&rt->dst); read_unlock_bh(&table->tb6_lock); ip6_del_rt(rt); goto restart; - } +} + } read_unlock_bh(&table->tb6_lock); } |