forked from Minki/linux
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>
This commit is contained in:
parent
cdf64c803e
commit
c486da3439
@ -2557,14 +2557,16 @@ static
|
||||
int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
struct net *net = current->nsproxy->net_ns;
|
||||
int delay = net->ipv6.sysctl.flush_delay;
|
||||
if (write) {
|
||||
struct net *net;
|
||||
int delay;
|
||||
if (!write)
|
||||
return -EINVAL;
|
||||
|
||||
net = (struct net *)ctl->extra1;
|
||||
delay = net->ipv6.sysctl.flush_delay;
|
||||
proc_dointvec(ctl, write, buffer, lenp, ppos);
|
||||
fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
|
||||
return 0;
|
||||
} else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctl_table ipv6_route_table_template[] = {
|
||||
@ -2651,6 +2653,7 @@ struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
|
||||
|
||||
if (table) {
|
||||
table[0].data = &net->ipv6.sysctl.flush_delay;
|
||||
table[0].extra1 = net;
|
||||
table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh;
|
||||
table[2].data = &net->ipv6.sysctl.ip6_rt_max_size;
|
||||
table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
|
||||
|
Loading…
Reference in New Issue
Block a user