]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netlink: specs: fou: change local-v6/peer-v6 check
authorAsbjørn Sloth Tønnesen <ast@fiberby.net>
Tue, 2 Sep 2025 15:46:35 +0000 (15:46 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Sep 2025 22:16:49 +0000 (15:16 -0700)
While updating the binary min-len implementation, I noticed that
the only user, should AFAICT be using exact-len instead.

In net/ipv4/fou_core.c FOU_ATTR_LOCAL_V6 and FOU_ATTR_PEER_V6
are only used for singular IPv6 addresses, and there are AFAICT
no known implementations trying to send more, it therefore
appears safe to change it to an exact-len policy.

This patch therefore changes the local-v6/peer-v6 attributes to
use an exact-len check, instead of a min-len check.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250902154640.759815-2-ast@fiberby.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/specs/fou.yaml
net/ipv4/fou_nl.c

index 57735726262ec36b2ca75482388115a6eed2b2fd..8e7974ec453fca1f975c3431da081ce2d9f34223 100644 (file)
@@ -52,7 +52,7 @@ attribute-sets:
         name: local-v6
         type: binary
         checks:
-          min-len: 16
+          exact-len: 16
       -
         name: peer-v4
         type: u32
@@ -60,7 +60,7 @@ attribute-sets:
         name: peer-v6
         type: binary
         checks:
-          min-len: 16
+          exact-len: 16
       -
         name: peer-port
         type: u16
index 3d9614609b2d3a6932f9a4090c2d70f86bfbc58c..506260b4a4dc26849ec0f9857c067b8e46800c7c 100644 (file)
@@ -18,9 +18,9 @@ const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
        [FOU_ATTR_TYPE] = { .type = NLA_U8, },
        [FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, },
        [FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, },
-       [FOU_ATTR_LOCAL_V6] = { .len = 16, },
+       [FOU_ATTR_LOCAL_V6] = NLA_POLICY_EXACT_LEN(16),
        [FOU_ATTR_PEER_V4] = { .type = NLA_U32, },
-       [FOU_ATTR_PEER_V6] = { .len = 16, },
+       [FOU_ATTR_PEER_V6] = NLA_POLICY_EXACT_LEN(16),
        [FOU_ATTR_PEER_PORT] = { .type = NLA_BE16, },
        [FOU_ATTR_IFINDEX] = { .type = NLA_S32, },
 };