summaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorBenjamin Thery2008-03-04 22:49:47 +0100
committerDavid S. Miller2008-03-04 22:49:47 +0100
commit6891a346c387bd0a64afa50f4522f5fe8ba879d8 (patch)
tree04f02aa5ea701d01baecb4ff34064d075ffe4d7a /net/ipv6/route.c
parent[NETNS][IPV6] route6 - move ip6_dst_ops inside the network namespace (diff)
downloadkernel-qcow2-linux-6891a346c387bd0a64afa50f4522f5fe8ba879d8.tar.gz
kernel-qcow2-linux-6891a346c387bd0a64afa50f4522f5fe8ba879d8.tar.xz
kernel-qcow2-linux-6891a346c387bd0a64afa50f4522f5fe8ba879d8.zip
[NETNS][IPV6] route6 - make garbage collection work with multiple network namespaces
This patch makes the necessary changes to make IPv6 dst_entry garbage collection work with multiple network namespaces. In ip6_dst_gc(), static local variables are now declared per-namespace. 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/route.c')
-rw-r--r--net/ipv6/route.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d88b6ec3c5d1..10a6cc0aca6c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -992,23 +992,22 @@ int icmp6_dst_gc(int *more)
static int ip6_dst_gc(struct dst_ops *ops)
{
- static unsigned expire = 30*HZ;
- static unsigned long last_gc;
+ struct net *net = ops->dst_net;
unsigned long now = jiffies;
- if (time_after(last_gc + init_net.ipv6.sysctl.ip6_rt_gc_min_interval, now) &&
- atomic_read(&init_net.ipv6.ip6_dst_ops->entries) <= init_net.ipv6.sysctl.ip6_rt_max_size)
+ if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) &&
+ atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size)
goto out;
- expire++;
- fib6_run_gc(expire, &init_net);
- last_gc = now;
- if (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) < init_net.ipv6.ip6_dst_ops->gc_thresh)
- expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1;
+ net->ipv6.ip6_rt_gc_expire++;
+ fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
+ net->ipv6.ip6_rt_last_gc = now;
+ if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh)
+ net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1;
out:
- expire -= expire>>init_net.ipv6.sysctl.ip6_rt_gc_elasticity;
- return (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) > init_net.ipv6.sysctl.ip6_rt_max_size);
+ net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity;
+ return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size);
}
/* Clean host part of a prefix. Not necessary in radix tree,
@@ -2615,6 +2614,8 @@ static int ip6_route_net_init(struct net *net)
proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
#endif
+ net->ipv6.ip6_rt_gc_expire = 30*HZ;
+
ret = 0;
out:
return ret;