]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: nexthop: Add flag to assert that NHGRP reserved fields are zero
authorPetr Machata <petrm@nvidia.com>
Wed, 7 Aug 2024 14:13:46 +0000 (16:13 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 Aug 2024 00:50:34 +0000 (17:50 -0700)
commit75bab45e6b2da379fe2ebda48ed35f8ce371a2ef
treee0d23f437e1d09f7f34046bb9ed46623c1ea7765
parent246ef40670b71fef0c3e2cd11404279bc6d6468e
net: nexthop: Add flag to assert that NHGRP reserved fields are zero

There are many unpatched kernel versions out there that do not initialize
the reserved fields of struct nexthop_grp. The issue with that is that if
those fields were to be used for some end (i.e. stop being reserved), old
kernels would still keep sending random data through the field, and a new
userspace could not rely on the value.

In this patch, use the existing NHA_OP_FLAGS, which is currently inbound
only, to carry flags back to the userspace. Add a flag to indicate that the
reserved fields in struct nexthop_grp are zeroed before dumping. This is
reliant on the actual fix from commit 6d745cd0e972 ("net: nexthop:
Initialize all fields in dumped nexthops").

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/21037748d4f9d8ff486151f4c09083bcf12d5df8.1723036486.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/nexthop.h
net/ipv4/nexthop.c