Re: [PATCH v3] ipv6: add `force_forwarding` sysctl to enable per-interface forwarding

From: Jakub Kicinski
Date: Wed Jul 02 2025 - 12:11:11 EST


On Wed, 2 Jul 2025 17:14:42 +0200 Nicolas Dichtel wrote:
> > Should we invert the polarity? It appears that the condition below only
> > let's this setting _disable_ forwarding. IMO calling it "force" suggests
> > to the user that it will force it to be enabled.
> Not sure to follow you. When force_forwarding is set to 1 the forwarding is
> always enabled.
>
> sysctl | all.forwarding | iface.force_forwarding | packet processing from iface
> | 0 | 0 | no forward
> | 0 | 1 | forward
> | 1 | 0 | forward
> | 1 | 1 | forward

Ugh, I can't read comparisons to zero.
Let's switch to more sane logic:

if (idev && !READ_ONCE(idev->cnf.force_forwarding) &&
!READ_ONCE(net->ipv6.devconf_all->forwarding))