Re: [PATCH net-next] ipv6: reset all.force_forwarding when disabling all.forwarding

From: Nicolas Dichtel

Date: Tue Nov 10 2026 - 13:16:49 EST


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