summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-09-04 12:14:12 -0700
committerPaolo Abeni <pabeni@redhat.com>2026-09-08 12:56:34 +0200
commit1859a0cc3adbc4ed2cb2dfe1cdb3bbc96b5d2cab (patch)
treea7ce830202901948a3f72285250f623da22459e7
parent3f4285d741b4017a3f36cc4cfa272d0343b60a5d (diff)
downloadlinux-next-1859a0cc3adbc4ed2cb2dfe1cdb3bbc96b5d2cab.tar.gz
linux-next-1859a0cc3adbc4ed2cb2dfe1cdb3bbc96b5d2cab.zip
netlink: specs: fou: link the type attribute to the encap-type enum
The spec defines encap-type (unspec / direct / gue), but no attribute references it, so the definition exists only to emit FOU_ENCAP_* into the uAPI header - while FOU_ATTR_TYPE is exactly that value space: fou_create() switches on FOU_ENCAP_DIRECT / FOU_ENCAP_GUE and returns -EINVAL for anything else. Python YNL could not accept or display the names and the generated C exposed a raw __u8 setter. The global policy entry becomes NLA_POLICY_MAX(NLA_U8, 2). For add that only moves the existing fou_create() rejection earlier; del and get ignore FOU_ATTR_TYPE altogether, so a bogus type there now fails validation instead of being dropped on the floor. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://patch.msgid.link/20260904191412.3872344-4-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--Documentation/netlink/specs/fou.yaml1
-rw-r--r--net/ipv4/fou_nl.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
index 1d0db6ba7e52..3e6a38e31202 100644
--- a/Documentation/netlink/specs/fou.yaml
+++ b/Documentation/netlink/specs/fou.yaml
@@ -44,6 +44,7 @@ attribute-sets:
-
name: type
type: u8
+ enum: encap-type
-
name: remcsum-nopartial
type: flag
diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
index cdb174b92cdd..ccd134ba352d 100644
--- a/net/ipv4/fou_nl.c
+++ b/net/ipv4/fou_nl.c
@@ -16,7 +16,7 @@ const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
[FOU_ATTR_PORT] = { .type = NLA_BE16, },
[FOU_ATTR_AF] = { .type = NLA_U8, },
[FOU_ATTR_IPPROTO] = NLA_POLICY_MIN(NLA_U8, 1),
- [FOU_ATTR_TYPE] = { .type = NLA_U8, },
+ [FOU_ATTR_TYPE] = NLA_POLICY_MAX(NLA_U8, 2),
[FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, },
[FOU_ATTR_LOCAL_V4] = { .type = NLA_BE32, },
[FOU_ATTR_LOCAL_V6] = NLA_POLICY_EXACT_LEN(16),