Skip to content

Commit e231736

Browse files
petrpavluroxanan1996
authored andcommitted
net/ipv6: Fix the RT cache flush via sysctl using a previous delay
BugLink: https://bugs.launchpad.net/bugs/2073765 [ Upstream commit 14a20e5b4ad998793c5f43b0330d9e1388446cf3 ] The net.ipv6.route.flush system parameter takes a value which specifies a delay used during the flush operation for aging exception routes. The written value is however not used in the currently requested flush and instead utilized only in the next one. A problem is that ipv6_sysctl_rtcache_flush() first reads the old value of net->ipv6.sysctl.flush_delay into a local delay variable and then calls proc_dointvec() which actually updates the sysctl based on the provided input. Fix the problem by switching the order of the two operations. Fixes: 4990509 ("[NETNS][IPV6]: Make sysctls route per namespace.") Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240607112828.30285-1-petr.pavlu@suse.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent a23624d commit e231736

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv6/route.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6346,12 +6346,12 @@ static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
63466346
if (!write)
63476347
return -EINVAL;
63486348

6349-
net = (struct net *)ctl->extra1;
6350-
delay = net->ipv6.sysctl.flush_delay;
63516349
ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
63526350
if (ret)
63536351
return ret;
63546352

6353+
net = (struct net *)ctl->extra1;
6354+
delay = net->ipv6.sysctl.flush_delay;
63556355
fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
63566356
return 0;
63576357
}

0 commit comments

Comments
 (0)