aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucian Adrian Grijincu <lucian.grijincu@gmail.com>2011-02-24 14:48:03 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-25 14:01:56 -0500
commitc486da34390846b430896a407b47f0cea3a4189c (patch)
tree2df7eb05f91354e0dc0468ed884326b121f76686
parentcdf64c803e6cfec72259f7bb2654261584bb80a8 (diff)
sysctl: ipv6: use correct net in ipv6_sysctl_rtcache_flush
Before this patch issuing these commands: fd = open("/proc/sys/net/ipv6/route/flush") unshare(CLONE_NEWNET) write(fd, "stuff") would flush the newly created net, not the original one. The equivalent ipv4 code is correct (stores the net inside ->extra1). Acked-by: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a998db6e7895..904312e25a3c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2557,14 +2557,16 @@ static
2557int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, 2557int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
2558 void __user *buffer, size_t *lenp, loff_t *ppos) 2558 void __user *buffer, size_t *lenp, loff_t *ppos)
2559{ 2559{
2560 struct net *net = current->nsproxy->net_ns; 2560 struct net *net;
2561 int delay = net->ipv6.sysctl.flush_delay; 2561 int delay;
2562 if (write) { 2562 if (!write)
2563 proc_dointvec(ctl, write, buffer, lenp, ppos);
2564 fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
2565 return 0;
2566 } else
2567 return -EINVAL; 2563 return -EINVAL;
2564
2565 net = (struct net *)ctl->extra1;
2566 delay = net->ipv6.sysctl.flush_delay;
2567 proc_dointvec(ctl, write, buffer, lenp, ppos);
2568 fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
2569 return 0;
2568} 2570}
2569 2571
2570ctl_table ipv6_route_table_template[] = { 2572ctl_table ipv6_route_table_template[] = {
@@ -2651,6 +2653,7 @@ struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
2651 2653
2652 if (table) { 2654 if (table) {
2653 table[0].data = &net->ipv6.sysctl.flush_delay; 2655 table[0].data = &net->ipv6.sysctl.flush_delay;
2656 table[0].extra1 = net;
2654 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; 2657 table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh;
2655 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; 2658 table[2].data = &net->ipv6.sysctl.ip6_rt_max_size;
2656 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; 2659 table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;