Re: [PATCH v2 2/2] docs: net: clarify sysctl value constraints

From: Simon Horman
Date: Tue Jun 17 2025 - 14:12:35 EST


On Sun, Jun 15, 2025 at 01:53:24AM +0300, Abdelrahman Fekry wrote:
> So, i also noticed that some of the parameters represented
> as boolean have no value constrain checks and accept integer
> values due to u8 implementation, so i wrote a note for every
> boolean parameter that have no constrain checks in code. and
> fixed a typo in fmwark instead of fwmark.
>
> Added notes for 19 confirmed parameters,
> Verified by code inspection and runtime testing.

Please consider using imperative mode in patch descriptions.

> - No changes for v2 in this patch , still waiting to be reviewed.

The text on the line above would fit better along
side the "No change." below the scissors ("---") a few lines below.

> Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@xxxxxxxxx>
> ---
> v2:
> - No change.
> v1:
> - Added notes for booleans that accept 0-255 not only 0/1.
> Documentation/networking/ip-sysctl.rst | 70 ++++++++++++++++++++------
> 1 file changed, 55 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/networking/ip-sysctl.rst
> index 68778532faa5..38f2981290d6 100644
> --- a/Documentation/networking/ip-sysctl.rst
> +++ b/Documentation/networking/ip-sysctl.rst
> @@ -70,6 +70,8 @@ ip_forward_use_pmtu - BOOLEAN
>
> - 0 - disabled
> - 1 - enabled
> +
> + note: Accepts integer values (0-255) but only 0/1 have defined behaviour.

In his review of v1 [*] Jacob said:

"Hm. In many cases any non-zero value might be interpreted as "enabled" I
suppose that is simply "undefined behavior"?

Looking over the parsing and use of ip_forward_use_pmtu (I did not check
the other parameters whose documentation this patch updates) I would take
Jacob's remark a few steps further.

It seems to me that values of 0-255 are accepted and while 0 means
disabled, all the other values mean enabled. That is because that
what the code does. And being part of the UAPI it can't be changed.

So I don't think it is correct to describe only values 0/1 having defined
behaviour. Because the code defines behaviour for all the values in the
range 0-255.

[*] https://lore.kernel.org/netdev/8b53b5be-82eb-458c-8269-d296bffcef33@xxxxxxxxx/

...