From 053468ff342686965037475dad1b8080c20c45e2 Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Wed, 28 Dec 2011 13:23:07 +0000 Subject: [PATCH] --- yaml --- r: 279148 b: refs/heads/master c: 32b293a53deeb220769f9a29357cb151cfb8ee26 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/net/ip6_fib.h | 4 ++++ trunk/net/ipv6/ip6_fib.c | 20 ++++++++++++++++++++ trunk/net/ipv6/route.c | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index efcc753a73b8..3b13813f525e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c9da99e6475f92653139e43f3c30c0cd011a0fd8 +refs/heads/master: 32b293a53deeb220769f9a29357cb151cfb8ee26 diff --git a/trunk/include/net/ip6_fib.h b/trunk/include/net/ip6_fib.h index 1e8a89f1002a..b26bb8101981 100644 --- a/trunk/include/net/ip6_fib.h +++ b/trunk/include/net/ip6_fib.h @@ -199,6 +199,10 @@ struct fib6_node *fib6_locate(struct fib6_node *root, const struct in6_addr *daddr, int dst_len, const struct in6_addr *saddr, int src_len); +extern void fib6_clean_all_ro(struct net *net, + int (*func)(struct rt6_info *, void *arg), + int prune, void *arg); + extern void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), int prune, void *arg); diff --git a/trunk/net/ipv6/ip6_fib.c b/trunk/net/ipv6/ip6_fib.c index 246d8e403f26..b82bcde53f7a 100644 --- a/trunk/net/ipv6/ip6_fib.c +++ b/trunk/net/ipv6/ip6_fib.c @@ -1462,6 +1462,26 @@ static void fib6_clean_tree(struct net *net, struct fib6_node *root, fib6_walk(&c.w); } +void fib6_clean_all_ro(struct net *net, int (*func)(struct rt6_info *, void *arg), + int prune, void *arg) +{ + struct fib6_table *table; + struct hlist_node *node; + struct hlist_head *head; + unsigned int h; + + rcu_read_lock(); + for (h = 0; h < FIB6_TABLE_HASHSZ; h++) { + head = &net->ipv6.fib_table_hash[h]; + hlist_for_each_entry_rcu(table, node, head, tb6_hlist) { + read_lock_bh(&table->tb6_lock); + fib6_clean_tree(net, &table->tb6_root, + func, prune, arg); + read_unlock_bh(&table->tb6_lock); + } + } + rcu_read_unlock(); +} void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), int prune, void *arg) { diff --git a/trunk/net/ipv6/route.c b/trunk/net/ipv6/route.c index 4a62c47599b4..07361dfa8085 100644 --- a/trunk/net/ipv6/route.c +++ b/trunk/net/ipv6/route.c @@ -2680,7 +2680,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) static int ipv6_route_show(struct seq_file *m, void *v) { struct net *net = (struct net *)m->private; - fib6_clean_all(net, rt6_info_route, 0, m); + fib6_clean_all_ro(net, rt6_info_route, 0, m); return 0; }