aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/netns/ipv6.h2
-rw-r--r--net/ipv6/route.c23
2 files changed, 14 insertions, 11 deletions
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 53b5a283a4b3..90e6e24df858 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -42,6 +42,8 @@ struct netns_ipv6 {
42 struct hlist_head *fib_table_hash; 42 struct hlist_head *fib_table_hash;
43 struct fib6_table *fib6_main_tbl; 43 struct fib6_table *fib6_main_tbl;
44 struct dst_ops *ip6_dst_ops; 44 struct dst_ops *ip6_dst_ops;
45 unsigned int ip6_rt_gc_expire;
46 unsigned long ip6_rt_last_gc;
45#ifdef CONFIG_IPV6_MULTIPLE_TABLES 47#ifdef CONFIG_IPV6_MULTIPLE_TABLES
46 struct rt6_info *ip6_prohibit_entry; 48 struct rt6_info *ip6_prohibit_entry;
47 struct rt6_info *ip6_blk_hole_entry; 49 struct rt6_info *ip6_blk_hole_entry;
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)
992 992
993static int ip6_dst_gc(struct dst_ops *ops) 993static int ip6_dst_gc(struct dst_ops *ops)
994{ 994{
995 static unsigned expire = 30*HZ; 995 struct net *net = ops->dst_net;
996 static unsigned long last_gc;
997 unsigned long now = jiffies; 996 unsigned long now = jiffies;
998 997
999 if (time_after(last_gc + init_net.ipv6.sysctl.ip6_rt_gc_min_interval, now) && 998 if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) &&
1000 atomic_read(&init_net.ipv6.ip6_dst_ops->entries) <= init_net.ipv6.sysctl.ip6_rt_max_size) 999 atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size)
1001 goto out; 1000 goto out;
1002 1001
1003 expire++; 1002 net->ipv6.ip6_rt_gc_expire++;
1004 fib6_run_gc(expire, &init_net); 1003 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
1005 last_gc = now; 1004 net->ipv6.ip6_rt_last_gc = now;
1006 if (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) < init_net.ipv6.ip6_dst_ops->gc_thresh) 1005 if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh)
1007 expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1; 1006 net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1;
1008 1007
1009out: 1008out:
1010 expire -= expire>>init_net.ipv6.sysctl.ip6_rt_gc_elasticity; 1009 net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity;
1011 return (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) > init_net.ipv6.sysctl.ip6_rt_max_size); 1010 return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size);
1012} 1011}
1013 1012
1014/* Clean host part of a prefix. Not necessary in radix tree, 1013/* Clean host part of a prefix. Not necessary in radix tree,
@@ -2615,6 +2614,8 @@ static int ip6_route_net_init(struct net *net)
2615 proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); 2614 proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
2616 proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); 2615 proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
2617#endif 2616#endif
2617 net->ipv6.ip6_rt_gc_expire = 30*HZ;
2618
2618 ret = 0; 2619 ret = 0;
2619out: 2620out:
2620 return ret; 2621 return ret;