aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ip6_fib.c24
-rw-r--r--net/ipv6/ndisc.c5
-rw-r--r--net/ipv6/route.c8
3 files changed, 24 insertions, 13 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 0f9dc81f0e6..9b1c232a29e 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -93,7 +93,10 @@ static int fib6_walk_continue(struct fib6_walker_t *w);
93 93
94static __u32 rt_sernum; 94static __u32 rt_sernum;
95 95
96static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0); 96static void fib6_gc_timer_cb(unsigned long arg);
97
98static DEFINE_TIMER(ip6_fib_timer, fib6_gc_timer_cb, 0,
99 (unsigned long)&init_net);
97 100
98static struct fib6_walker_t fib6_walker_list = { 101static struct fib6_walker_t fib6_walker_list = {
99 .prev = &fib6_walker_list, 102 .prev = &fib6_walker_list,
@@ -1432,12 +1435,12 @@ static int fib6_age(struct rt6_info *rt, void *arg)
1432 1435
1433static DEFINE_SPINLOCK(fib6_gc_lock); 1436static DEFINE_SPINLOCK(fib6_gc_lock);
1434 1437
1435void fib6_run_gc(unsigned long dummy) 1438void fib6_run_gc(unsigned long expires, struct net *net)
1436{ 1439{
1437 if (dummy != ~0UL) { 1440 if (expires != ~0UL) {
1438 spin_lock_bh(&fib6_gc_lock); 1441 spin_lock_bh(&fib6_gc_lock);
1439 gc_args.timeout = dummy ? (int)dummy : 1442 gc_args.timeout = expires ? (int)expires :
1440 init_net.ipv6.sysctl.ip6_rt_gc_interval; 1443 net->ipv6.sysctl.ip6_rt_gc_interval;
1441 } else { 1444 } else {
1442 local_bh_disable(); 1445 local_bh_disable();
1443 if (!spin_trylock(&fib6_gc_lock)) { 1446 if (!spin_trylock(&fib6_gc_lock)) {
@@ -1445,17 +1448,17 @@ void fib6_run_gc(unsigned long dummy)
1445 local_bh_enable(); 1448 local_bh_enable();
1446 return; 1449 return;
1447 } 1450 }
1448 gc_args.timeout = init_net.ipv6.sysctl.ip6_rt_gc_interval; 1451 gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
1449 } 1452 }
1450 gc_args.more = 0; 1453 gc_args.more = 0;
1451 1454
1452 icmp6_dst_gc(&gc_args.more); 1455 icmp6_dst_gc(&gc_args.more);
1453 1456
1454 fib6_clean_all(&init_net, fib6_age, 0, NULL); 1457 fib6_clean_all(net, fib6_age, 0, NULL);
1455 1458
1456 if (gc_args.more) 1459 if (gc_args.more)
1457 mod_timer(&ip6_fib_timer, jiffies + 1460 mod_timer(&ip6_fib_timer, jiffies +
1458 init_net.ipv6.sysctl.ip6_rt_gc_interval); 1461 net->ipv6.sysctl.ip6_rt_gc_interval);
1459 else { 1462 else {
1460 del_timer(&ip6_fib_timer); 1463 del_timer(&ip6_fib_timer);
1461 ip6_fib_timer.expires = 0; 1464 ip6_fib_timer.expires = 0;
@@ -1463,6 +1466,11 @@ void fib6_run_gc(unsigned long dummy)
1463 spin_unlock_bh(&fib6_gc_lock); 1466 spin_unlock_bh(&fib6_gc_lock);
1464} 1467}
1465 1468
1469static void fib6_gc_timer_cb(unsigned long arg)
1470{
1471 fib6_run_gc(0, (struct net *)arg);
1472}
1473
1466static int fib6_net_init(struct net *net) 1474static int fib6_net_init(struct net *net)
1467{ 1475{
1468 int ret; 1476 int ret;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index eb322959a3e..f1c95125100 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1598,6 +1598,7 @@ int ndisc_rcv(struct sk_buff *skb)
1598static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) 1598static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
1599{ 1599{
1600 struct net_device *dev = ptr; 1600 struct net_device *dev = ptr;
1601 struct net *net = dev->nd_net;
1601 1602
1602 if (dev->nd_net != &init_net) 1603 if (dev->nd_net != &init_net)
1603 return NOTIFY_DONE; 1604 return NOTIFY_DONE;
@@ -1605,11 +1606,11 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
1605 switch (event) { 1606 switch (event) {
1606 case NETDEV_CHANGEADDR: 1607 case NETDEV_CHANGEADDR:
1607 neigh_changeaddr(&nd_tbl, dev); 1608 neigh_changeaddr(&nd_tbl, dev);
1608 fib6_run_gc(~0UL); 1609 fib6_run_gc(~0UL, net);
1609 break; 1610 break;
1610 case NETDEV_DOWN: 1611 case NETDEV_DOWN:
1611 neigh_ifdown(&nd_tbl, dev); 1612 neigh_ifdown(&nd_tbl, dev);
1612 fib6_run_gc(~0UL); 1613 fib6_run_gc(~0UL, net);
1613 break; 1614 break;
1614 default: 1615 default:
1615 break; 1616 break;
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 @@
40#include <linux/if_arp.h> 40#include <linux/if_arp.h>
41#include <linux/proc_fs.h> 41#include <linux/proc_fs.h>
42#include <linux/seq_file.h> 42#include <linux/seq_file.h>
43#include <linux/nsproxy.h>
43#include <net/net_namespace.h> 44#include <net/net_namespace.h>
44#include <net/snmp.h> 45#include <net/snmp.h>
45#include <net/ipv6.h> 46#include <net/ipv6.h>
@@ -995,7 +996,7 @@ static int ip6_dst_gc(struct dst_ops *ops)
995 goto out; 996 goto out;
996 997
997 expire++; 998 expire++;
998 fib6_run_gc(expire); 999 fib6_run_gc(expire, &init_net);
999 last_gc = now; 1000 last_gc = now;
1000 if (atomic_read(&ip6_dst_ops.entries) < ip6_dst_ops.gc_thresh) 1001 if (atomic_read(&ip6_dst_ops.entries) < ip6_dst_ops.gc_thresh)
1001 expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1; 1002 expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1;
@@ -2413,10 +2414,11 @@ static
2413int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp, 2414int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
2414 void __user *buffer, size_t *lenp, loff_t *ppos) 2415 void __user *buffer, size_t *lenp, loff_t *ppos)
2415{ 2416{
2416 int delay = init_net.ipv6.sysctl.flush_delay; 2417 struct net *net = current->nsproxy->net_ns;
2418 int delay = net->ipv6.sysctl.flush_delay;
2417 if (write) { 2419 if (write) {
2418 proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 2420 proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
2419 fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay); 2421 fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
2420 return 0; 2422 return 0;
2421 } else 2423 } else
2422 return -EINVAL; 2424 return -EINVAL;