summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Thery <benjamin.thery@bull.net>2008-03-03 23:31:57 -0800
committerDavid S. Miller <davem@davemloft.net>2008-03-03 23:31:57 -0800
commitec7d43c291df9f6e978733f892f7255be89feedb (patch)
tree36b890640fbb5761053a6f27f79b6c2c7ae84ab1
parent63152fc0de4dfe83da543bf133cef73d885a50fc (diff)
downloadop-kernel-dev-ec7d43c291df9f6e978733f892f7255be89feedb.zip
op-kernel-dev-ec7d43c291df9f6e978733f892f7255be89feedb.tar.gz
[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>
-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 4aa6798..350a970 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -66,6 +66,7 @@ enum fib_walk_state_t
struct fib6_cleaner_t
{
struct fib6_walker_t w;
+ struct net *net;
int (*func)(struct rt6_info *, void *arg);
void *arg;
};
@@ -78,7 +79,8 @@ static DEFINE_RWLOCK(fib6_walker_lock);
#define FWS_INIT FWS_L
#endif
-static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt);
+static void fib6_prune_clones(struct net *net, struct fib6_node *fn,
+ struct rt6_info *rt);
static struct rt6_info * fib6_find_prefix(struct fib6_node *fn);
static struct fib6_node * fib6_repair_tree(struct fib6_node *fn);
static 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)
if (err == 0) {
fib6_start_gc(info->nl_net, rt);
if (!(rt->rt6i_flags&RTF_CACHE))
- fib6_prune_clones(pn, rt);
+ fib6_prune_clones(info->nl_net, pn, rt);
}
out:
@@ -1168,7 +1170,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
pn = pn->parent;
}
#endif
- fib6_prune_clones(pn, rt);
+ fib6_prune_clones(info->nl_net, pn, rt);
}
/*
@@ -1298,12 +1300,12 @@ static int fib6_walk(struct fib6_walker_t *w)
static int fib6_clean_node(struct fib6_walker_t *w)
{
- struct nl_info info = {
- .nl_net = &init_net,
- };
int res;
struct rt6_info *rt;
struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
+ struct nl_info info = {
+ .nl_net = c->net,
+ };
for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
res = c->func(rt, c->arg);
@@ -1335,7 +1337,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
* ignoring pure split nodes) will be scanned.
*/
-static void fib6_clean_tree(struct fib6_node *root,
+static void fib6_clean_tree(struct net *net, struct fib6_node *root,
int (*func)(struct rt6_info *, void *arg),
int prune, void *arg)
{
@@ -1346,6 +1348,7 @@ static void fib6_clean_tree(struct fib6_node *root,
c.w.prune = prune;
c.func = func;
c.arg = arg;
+ c.net = net;
fib6_walk(&c.w);
}
@@ -1363,7 +1366,8 @@ void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
head = &net->ipv6.fib_table_hash[h];
hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
write_lock_bh(&table->tb6_lock);
- fib6_clean_tree(&table->tb6_root, func, prune, arg);
+ fib6_clean_tree(net, &table->tb6_root,
+ func, prune, arg);
write_unlock_bh(&table->tb6_lock);
}
}
@@ -1380,9 +1384,10 @@ static int fib6_prune_clone(struct rt6_info *rt, void *arg)
return 0;
}
-static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt)
+static void fib6_prune_clones(struct net *net, struct fib6_node *fn,
+ struct rt6_info *rt)
{
- fib6_clean_tree(fn, fib6_prune_clone, 1, rt);
+ fib6_clean_tree(net, fn, fib6_prune_clone, 1, rt);
}
/*
OpenPOWER on IntegriCloud