Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] netlink: specs: fou: spec tweaks
@ 2026-09-04 19:14 Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 1/3] netlink: specs: fou: add af to the shared attribute list Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-09-04 19:14 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	kuniyu, Jakub Kicinski

FOU was one of the initial families I used to develop YNL against.
It's not using YNL features which were added later, fill in the gaps.

Jakub Kicinski (3):
  netlink: specs: fou: add af to the shared attribute list
  netlink: specs: fou: local-v4 and peer-v4 are big endian
  netlink: specs: fou: link the type attribute to the encap-type enum

 Documentation/netlink/specs/fou.yaml | 4 ++++
 net/ipv4/fou_nl.c                    | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/3] netlink: specs: fou: add af to the shared attribute list
  2026-09-04 19:14 [PATCH net-next 0/3] netlink: specs: fou: spec tweaks Jakub Kicinski
@ 2026-09-04 19:14 ` Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 3/3] netlink: specs: fou: link the type attribute to the encap-type enum Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-09-04 19:14 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	kuniyu, Jakub Kicinski

parse_nl_config() is the only place the address family is chosen: it
defaults cfg->udp_config.family to AF_INET and only switches to
AF_INET6 when FOU_ATTR_AF is present. The &all_attrs anchor - the add
request, and the get do and dump reply - does not list af, so a ynl
generated client has no fou_add_req_set_af() and can never create an
IPv6 FOU port; the local-v6 / peer-v6 attributes it does list are read
by nothing. On the reply side fou_fill_info() puts FOU_ATTR_AF
unconditionally, and struct fou_get_rsp has no member for it.

kernel-policy is global, so fou_nl_ops[] carries no per-op attribute
list and af is already in fou_nl_policy through &select_attrs - only
the user space codegen and the rendered docs change, ynl-regen.sh
produces no diff.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/fou.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
index 331f1b342b3a..32d34be1dc63 100644
--- a/Documentation/netlink/specs/fou.yaml
+++ b/Documentation/netlink/specs/fou.yaml
@@ -90,6 +90,7 @@ kernel-policy: global
         request: &all_attrs
           attributes:
             - port
+            - af
             - ipproto
             - type
             - remcsum-nopartial
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian
  2026-09-04 19:14 [PATCH net-next 0/3] netlink: specs: fou: spec tweaks Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 1/3] netlink: specs: fou: add af to the shared attribute list Jakub Kicinski
@ 2026-09-04 19:14 ` Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 3/3] netlink: specs: fou: link the type attribute to the encap-type enum Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-09-04 19:14 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	kuniyu, Jakub Kicinski

fou_core.c uses nla_get_in_addr() / nla_put_in_addr() on both, i.e.
they are __be32, and port / peer-port in the same spec are already
annotated. Without byte-order YNL swaps them on little endian hosts.

The generated policy goes from NLA_U32 to NLA_BE32, which changes
nothing: lib/nlattr.c gives the two the same length in nla_attr_len[]
and the same range handling, and neither attribute has a range check.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/fou.yaml | 2 ++
 net/ipv4/fou_nl.c                    | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
index 32d34be1dc63..1d0db6ba7e52 100644
--- a/Documentation/netlink/specs/fou.yaml
+++ b/Documentation/netlink/specs/fou.yaml
@@ -50,6 +50,7 @@ kernel-policy: global
       -
         name: local-v4
         type: u32
+        byte-order: big-endian
       -
         name: local-v6
         type: binary
@@ -58,6 +59,7 @@ kernel-policy: global
       -
         name: peer-v4
         type: u32
+        byte-order: big-endian
       -
         name: peer-v6
         type: binary
diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
index 309d5ba983d0..cdb174b92cdd 100644
--- a/net/ipv4/fou_nl.c
+++ b/net/ipv4/fou_nl.c
@@ -18,9 +18,9 @@ const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
 	[FOU_ATTR_IPPROTO] = NLA_POLICY_MIN(NLA_U8, 1),
 	[FOU_ATTR_TYPE] = { .type = NLA_U8, },
 	[FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, },
-	[FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, },
+	[FOU_ATTR_LOCAL_V4] = { .type = NLA_BE32, },
 	[FOU_ATTR_LOCAL_V6] = NLA_POLICY_EXACT_LEN(16),
-	[FOU_ATTR_PEER_V4] = { .type = NLA_U32, },
+	[FOU_ATTR_PEER_V4] = { .type = NLA_BE32, },
 	[FOU_ATTR_PEER_V6] = NLA_POLICY_EXACT_LEN(16),
 	[FOU_ATTR_PEER_PORT] = { .type = NLA_BE16, },
 	[FOU_ATTR_IFINDEX] = { .type = NLA_S32, },
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 3/3] netlink: specs: fou: link the type attribute to the encap-type enum
  2026-09-04 19:14 [PATCH net-next 0/3] netlink: specs: fou: spec tweaks Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 1/3] netlink: specs: fou: add af to the shared attribute list Jakub Kicinski
  2026-09-04 19:14 ` [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian Jakub Kicinski
@ 2026-09-04 19:14 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-09-04 19:14 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	kuniyu, Jakub Kicinski

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>
---
 Documentation/netlink/specs/fou.yaml | 1 +
 net/ipv4/fou_nl.c                    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

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 @@ kernel-policy: global
       -
         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),
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-04 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 19:14 [PATCH net-next 0/3] netlink: specs: fou: spec tweaks Jakub Kicinski
2026-09-04 19:14 ` [PATCH net-next 1/3] netlink: specs: fou: add af to the shared attribute list Jakub Kicinski
2026-09-04 19:14 ` [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian Jakub Kicinski
2026-09-04 19:14 ` [PATCH net-next 3/3] netlink: specs: fou: link the type attribute to the encap-type enum Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox