From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, donald.hunter@gmail.com,
kuniyu@google.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian
Date: Fri, 4 Sep 2026 12:14:11 -0700 [thread overview]
Message-ID: <20260904191412.3872344-3-kuba@kernel.org> (raw)
In-Reply-To: <20260904191412.3872344-1-kuba@kernel.org>
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
next prev parent reply other threads:[~2026-09-04 19:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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-07 10:04 ` Nicolas Dichtel
2026-09-07 19:14 ` netdev-bot+sashiko
2026-09-04 19:14 ` Jakub Kicinski [this message]
2026-09-07 10:05 ` [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian Nicolas Dichtel
2026-09-07 19:14 ` netdev-bot+sashiko
2026-09-08 10:56 ` Paolo Abeni
2026-09-04 19:14 ` [PATCH net-next 3/3] netlink: specs: fou: link the type attribute to the encap-type enum Jakub Kicinski
2026-09-07 10:05 ` Nicolas Dichtel
2026-09-08 11:00 ` [PATCH net-next 0/3] netlink: specs: fou: spec tweaks patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260904191412.3872344-3-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.