aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-03 23:28:58 -0800
committerDavid S. Miller <davem@davemloft.net>2008-03-03 23:28:58 -0800
commit5b7c931dff03621ae7ac524c4fa280d4e5f187a4 (patch)
tree9b3eda8e34816c0ac45cff8ce73d19f6bd11b4dd /net/ipv6/route.c
parentf3db48517f59133610f558f29de8834d7b007691 (diff)
[NETNS][IPV6] ip6_fib - add net to gc timer parameter
The fib tables are now relative to the network namespace. When the garbage collector timer expires, we must have a network namespace parameter in order to retrieve the tables. For now this is the init_net, but we should be able to have a timer per namespace and use the timer callback parameter to pass the network namespace from the expired timer. The timer callback, fib6_run_gc, is actually used to be called synchronously by some functions and asynchronously when the timer expires. When the timer expires, the delay specified for fib6_run_gc parameter is always zero. So, I changed fib6_run_gc to not be a timer callback but a function called by the timer callback and I added a timer callback where its work is just to retrieve from the data arg of the timer the network namespace and call fib6_run_gc with zero expiring time and the network namespace parameters. That makes the code cleaner for the fib6_run_gc callers. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2e6da2afd94..fd44721abeb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -40,6 +40,7 @@
#include <linux/if_arp.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/nsproxy.h>
#include <net/net_namespace.h>
#include <net/snmp.h>
#include <net/ipv6.h>
@@ -995,7 +996,7 @@ static int ip6_dst_gc(struct dst_ops *ops)
goto out;
expire++;
- fib6_run_gc(expire);
+ fib6_run_gc(expire, &init_net);
last_gc = now;
if (atomic_read(&ip6_dst_ops.entries) < ip6_dst_ops.gc_thresh)
expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1;
@@ -2413,10 +2414,11 @@ static
int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
- int delay = init_net.ipv6.sysctl.flush_delay;
+ struct net *net = current->nsproxy->net_ns;
+ int delay = net->ipv6.sysctl.flush_delay;
if (write) {
proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
- fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay);
+ fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
return 0;
} else
return -EINVAL;