aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_fib.c
diff options
context:
space:
mode:
authorBenjamin Thery <benjamin.thery@bull.net>2008-03-04 02:31:57 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-04 02:31:57 -0500
commitec7d43c291df9f6e978733f892f7255be89feedb (patch)
tree36b890640fbb5761053a6f27f79b6c2c7ae84ab1 /net/ipv6/ip6_fib.c
parent63152fc0de4dfe83da543bf133cef73d885a50fc (diff)
[NETNS][IPV6] ip6_fib - clean node use namespace
The fib6_clean_node function should have the network namespace it is working on. The fib6_cleaner_t structure is extended with the network namespace field to be passed to the fib6_clean_node function. The different functions calling the fib6_clean_node function are extended with the netns parameter when needed to propagate the netns pointer. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r--net/ipv6/ip6_fib.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 4aa67988f51..350a970ca1e 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -66,6 +66,7 @@ enum fib_walk_state_t
66struct fib6_cleaner_t 66struct fib6_cleaner_t
67{ 67{
68 struct fib6_walker_t w; 68 struct fib6_walker_t w;
69 struct net *net;
69 int (*func)(struct rt6_info *, void *arg); 70 int (*func)(struct rt6_info *, void *arg);
70 void *arg; 71 void *arg;
71}; 72};
@@ -78,7 +79,8 @@ static DEFINE_RWLOCK(fib6_walker_lock);
78#define FWS_INIT FWS_L 79#define FWS_INIT FWS_L
79#endif 80#endif
80 81
81static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt); 82static void fib6_prune_clones(struct net *net, struct fib6_node *fn,
83 struct rt6_info *rt);
82static struct rt6_info * fib6_find_prefix(struct fib6_node *fn); 84static struct rt6_info * fib6_find_prefix(struct fib6_node *fn);
83static struct fib6_node * fib6_repair_tree(struct fib6_node *fn); 85static struct fib6_node * fib6_repair_tree(struct fib6_node *fn);
84static int fib6_walk(struct fib6_walker_t *w); 86static int fib6_walk(struct fib6_walker_t *w);
@@ -762,7 +764,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
762 if (err == 0) { 764 if (err == 0) {
763 fib6_start_gc(info->nl_net, rt); 765 fib6_start_gc(info->nl_net, rt);
764 if (!(rt->rt6i_flags&RTF_CACHE)) 766 if (!(rt->rt6i_flags&RTF_CACHE))
765 fib6_prune_clones(pn, rt); 767 fib6_prune_clones(info->nl_net, pn, rt);
766 } 768 }
767 769
768out: 770out:
@@ -1168,7 +1170,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
1168 pn = pn->parent; 1170 pn = pn->parent;
1169 } 1171 }
1170#endif 1172#endif
1171 fib6_prune_clones(pn, rt); 1173 fib6_prune_clones(info->nl_net, pn, rt);
1172 } 1174 }
1173 1175
1174 /* 1176 /*
@@ -1298,12 +1300,12 @@ static int fib6_walk(struct fib6_walker_t *w)
1298 1300
1299static int fib6_clean_node(struct fib6_walker_t *w) 1301static int fib6_clean_node(struct fib6_walker_t *w)
1300{ 1302{
1301 struct nl_info info = {
1302 .nl_net = &init_net,
1303 };
1304 int res; 1303 int res;
1305 struct rt6_info *rt; 1304 struct rt6_info *rt;
1306 struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w); 1305 struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
1306 struct nl_info info = {
1307 .nl_net = c->net,
1308 };
1307 1309
1308 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { 1310 for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
1309 res = c->func(rt, c->arg); 1311 res = c->func(rt, c->arg);
@@ -1335,7 +1337,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
1335 * ignoring pure split nodes) will be scanned. 1337 * ignoring pure split nodes) will be scanned.
1336 */ 1338 */
1337 1339
1338static void fib6_clean_tree(struct fib6_node *root, 1340static void fib6_clean_tree(struct net *net, struct fib6_node *root,
1339 int (*func)(struct rt6_info *, void *arg), 1341 int (*func)(struct rt6_info *, void *arg),
1340 int prune, void *arg) 1342 int prune, void *arg)
1341{ 1343{
@@ -1346,6 +1348,7 @@ static void fib6_clean_tree(struct fib6_node *root,
1346 c.w.prune = prune; 1348 c.w.prune = prune;
1347 c.func = func; 1349 c.func = func;
1348 c.arg = arg; 1350 c.arg = arg;
1351 c.net = net;
1349 1352
1350 fib6_walk(&c.w); 1353 fib6_walk(&c.w);
1351} 1354}
@@ -1363,7 +1366,8 @@ void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
1363 head = &net->ipv6.fib_table_hash[h]; 1366 head = &net->ipv6.fib_table_hash[h];
1364 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) { 1367 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
1365 write_lock_bh(&table->tb6_lock); 1368 write_lock_bh(&table->tb6_lock);
1366 fib6_clean_tree(&table->tb6_root, func, prune, arg); 1369 fib6_clean_tree(net, &table->tb6_root,
1370 func, prune, arg);
1367 write_unlock_bh(&table->tb6_lock); 1371 write_unlock_bh(&table->tb6_lock);
1368 } 1372 }
1369 } 1373 }
@@ -1380,9 +1384,10 @@ static int fib6_prune_clone(struct rt6_info *rt, void *arg)
1380 return 0; 1384 return 0;
1381} 1385}
1382 1386
1383static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt) 1387static void fib6_prune_clones(struct net *net, struct fib6_node *fn,
1388 struct rt6_info *rt)
1384{ 1389{
1385 fib6_clean_tree(fn, fib6_prune_clone, 1, rt); 1390 fib6_clean_tree(net, fn, fib6_prune_clone, 1, rt);
1386} 1391}
1387 1392
1388/* 1393/*