diff options
author | Lucian Adrian Grijincu <lucian.grijincu@gmail.com> | 2011-02-24 14:48:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-25 14:01:56 -0500 |
commit | c486da34390846b430896a407b47f0cea3a4189c (patch) | |
tree | 2df7eb05f91354e0dc0468ed884326b121f76686 /net | |
parent | cdf64c803e6cfec72259f7bb2654261584bb80a8 (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>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/route.c | 17 |
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 | |||
2557 | int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, | 2557 | int 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 | ||
2570 | ctl_table ipv6_route_table_template[] = { | 2572 | ctl_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; |