Re: [PATCH net-next] ipv6: reset all.force_forwarding when disabling all.forwarding
From: Gabriel Goller
Date: Thu Nov 12 2026 - 08:44:01 EST
On 10.11.2026 18:34, Nicolas Dichtel wrote:
> Le 09/11/2026 à 16:53, Gabriel Goller a écrit :
> > Disabling all.forwarding resets force_forwarding on every interface, but
> > leaves all.force_forwarding set:
> >
> > # sysctl -wq net.ipv6.conf.all.forwarding=1
> > # sysctl -wq net.ipv6.conf.all.force_forwarding=1
> > # sysctl -wq net.ipv6.conf.all.forwarding=0
> > # sysctl net.ipv6.conf.dummy1.force_forwarding
> > net.ipv6.conf.dummy1.force_forwarding = 0
> > # sysctl net.ipv6.conf.all.force_forwarding
> > net.ipv6.conf.all.force_forwarding = 1
> >
> > Writing 1 to all.force_forwarding afterwards is ignored because the
> > value did not change, so the interfaces are not re-enabled.
> >
> > Reset all.force_forwarding too and notify netconf listeners.
> >
> > Suggested-by: Ido Schimmel <idosch@xxxxxxxxxx>
> > Signed-off-by: Gabriel Goller <g.goller@xxxxxxxxxxx>
>
> There is the same effect if an interface entry is reset:
>
> $ sysctl -wq net.ipv6.conf.all.force_forwarding=1
> $ sysctl net.ipv6.conf.ntfp1.force_forwarding net.ipv6.conf.all.force_forwarding
> net.ipv6.conf.ntfp1.force_forwarding = 1
> net.ipv6.conf.all.force_forwarding = 1
> $ sysctl -wq net.ipv6.conf.ntfp1.force_forwarding=0
> $ sysctl net.ipv6.conf.ntfp1.force_forwarding net.ipv6.conf.all.force_forwarding
> net.ipv6.conf.ntfp1.force_forwarding = 0
> net.ipv6.conf.all.force_forwarding = 1
> $ sysctl -wq net.ipv6.conf.all.force_forwarding=1
> $ sysctl net.ipv6.conf.ntfp1.force_forwarding net.ipv6.conf.all.force_forwarding
> net.ipv6.conf.ntfp1.force_forwarding = 0
> net.ipv6.conf.all.force_forwarding = 1
>
> Maybe the new value should be applied whatever the old value was for the 'all'
> entry (like for net.ipv6.conf.all.forwarding).
>
> Note that, it is the same for ipv4 forwarding:
>
> $ sysctl -wq net.ipv4.conf.all.forwarding=1
> $ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.ntfp1.forwarding
> net.ipv4.conf.all.forwarding = 1
> net.ipv4.conf.ntfp1.forwarding = 1
> $ sysctl -wq net.ipv4.conf.ntfp1.forwarding=0
> $ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.ntfp1.forwarding
> net.ipv4.conf.all.forwarding = 1
> net.ipv4.conf.ntfp1.forwarding = 0
> $ sysctl -wq net.ipv4.conf.all.forwarding=1
> $ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.ntfp1.forwarding
> net.ipv4.conf.all.forwarding = 1
> net.ipv4.conf.ntfp1.forwarding = 0
>
> but not for ipv6 forwarding:
> $ sysctl -wq net.ipv6.conf.all.forwarding=1
> $ sysctl net.ipv6.conf.all.forwarding net.ipv6.conf.ntfp1.forwarding
> net.ipv6.conf.all.forwarding = 1
> net.ipv6.conf.ntfp1.forwarding = 1
> $ sysctl -wq net.ipv6.conf.ntfp1.forwarding=0
> $ sysctl net.ipv6.conf.all.forwarding net.ipv6.conf.ntfp1.forwarding
> net.ipv6.conf.all.forwarding = 1
> net.ipv6.conf.ntfp1.forwarding = 0
> $ sysctl -wq net.ipv6.conf.all.forwarding=1
> $ sysctl net.ipv6.conf.all.forwarding net.ipv6.conf.ntfp1.forwarding
> net.ipv6.conf.all.forwarding = 1
> net.ipv6.conf.ntfp1.forwarding = 1
Makes sense, aligned the behavior to ipv6 forwarding with this patch:
https://lore.kernel.org/all/20261112-ipv6_always_apply-v1-1-8df846631005@xxxxxxxxxxx/
This patch is still relevant.
Thanks for the review.
Gabriel