From: netdev-bot+sashiko@kernel.org
To: kuba@kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
donald.hunter@gmail.com, kuniyu@google.com
Subject: Re: [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian
Date: Mon, 07 Sep 2026 19:14:24 +0000 [thread overview]
Message-ID: <178880846466.219967.3542374542122357419@kernel.org> (raw)
In-Reply-To: <20260904191412.3872344-3-kuba@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 1 · Low: 1
- [Medium] Switching `FOU_ATTR_LOCAL_V4` / `FOU_ATTR_PEER_V4` from
`NLA_U32` to `NLA_BE32` in `fou_nl_policy[]` (net/ipv4/fou_nl.c:21,23)…
- [Low] The patch fixes a real, user-visible YNL byte-order defect
(missing `byte-order: big-endian` on fou's `local-v4`/`peer-v4`) but…
--
netlink: specs: fou: local-v4 and peer-v4 are big endian
This adds byte-order: big-endian to the local-v4 and peer-v4 attributes in
the fou netlink spec, since fou_core.c treats both as __be32 via
nla_get_in_addr() / nla_put_in_addr(). The regenerated policy in
net/ipv4/fou_nl.c changes the two entries from NLA_U32 to NLA_BE32.
No Link: tags present in the commit header.
> diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
> index 32d34be1dc63a..1d0db6ba7e52b 100644
> --- a/Documentation/netlink/specs/fou.yaml
> +++ b/Documentation/netlink/specs/fou.yaml
> @@ -50,6 +50,7 @@ attribute-sets:
> -
> name: local-v4
> type: u32
> + byte-order: big-endian
> -
> name: local-v6
> type: binary
> @@ -58,6 +59,7 @@ attribute-sets:
> -
> name: peer-v4
> type: u32
> + byte-order: big-endian
> -
> name: peer-v6
> type: binary
[Severity: Low]
Should this carry a Fixes: tag? The commit message describes a
user-visible YNL defect ("Without byte-order YNL swaps them on little
endian hosts"), and the annotations were missing from the moment the spec
was added by commit 4eb77b4ecd3c ("netlink: add a proto specification for
FOU").
The kernel side has always treated both as network-order addresses:
net/ipv4/fou_core.c:parse_nl_config() {
...
cfg->udp_config.local_ip.s_addr = nla_get_in_addr(attr);
...
}
net/ipv4/fou_core.c:fou_fill_info() {
...
if (nla_put_in_addr(msg, FOU_ATTR_LOCAL_V4, sk->sk_rcv_saddr))
...
}
so a ynl client on a little-endian host configures and displays a reversed
address. Would adding:
Fixes: 4eb77b4ecd3c ("netlink: add a proto specification for FOU")
let backport tooling pick this up?
> diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
> index 309d5ba983d04..cdb174b92cdd2 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, },
[Severity: Medium]
The commit message says the policy change "changes nothing". Is that
accurate for policy introspection as well as for validation?
The validation claim holds: nla_attr_len[] in lib/nlattr.c gives NLA_BE32
and NLA_U32 the same length, the range handling is shared, and neither
attribute has a range check.
But the policy dump has no NLA_BE16/NLA_BE32 arm, so NLA_BE32 lands in the
default case that is shared with NLA_UNSPEC and NLA_REJECT:
net/netlink/policy.c:__netlink_policy_dump_write_attr() {
...
switch (pt->type) {
default:
case NLA_UNSPEC:
case NLA_REJECT:
/* skip - use NLA_MIN_LEN to advertise such */
nla_nest_cancel(skb, attr);
return -ENODATA;
...
}
and the caller turns -ENODATA into "skip this attribute":
net/netlink/policy.c:netlink_policy_dump_write() {
...
err = __netlink_policy_dump_write_attr(state, skb, pt, state->attr_idx);
if (err == -ENODATA) {
nla_nest_cancel(skb, policy);
again = true;
goto next;
}
...
}
fou registers fou_nl_policy family-wide (.policy = fou_nl_policy in
fou_nl_family), so this is the policy exported through CTRL_CMD_GETPOLICY.
Does that mean FOU_ATTR_LOCAL_V4 and FOU_ATTR_PEER_V4 disappear from the
policy dump, where they previously showed up as NL_ATTR_TYPE_U32 with a
0..U32_MAX range?
Tooling that feature-probes attributes via the policy dump (ynl, the
wireshark netlink dissector) would then see them as absent. FOU_ATTR_PORT
and FOU_ATTR_PEER_PORT already have the same problem as NLA_BE16, so would
it make sense to add NLA_BE16/NLA_BE32 cases to
__netlink_policy_dump_write_attr(), or at least to mention this in the
changelog instead of "changes nothing"?
> [FOU_ATTR_PEER_V6] = NLA_POLICY_EXACT_LEN(16),
> [FOU_ATTR_PEER_PORT] = { .type = NLA_BE16, },
> [FOU_ATTR_IFINDEX] = { .type = NLA_S32, },
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260904191412.3872344-1-kuba%40kernel.org
next prev parent reply other threads:[~2026-09-07 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 ` [PATCH net-next 2/3] netlink: specs: fou: local-v4 and peer-v4 are big endian Jakub Kicinski
2026-09-07 10:05 ` Nicolas Dichtel
2026-09-07 19:14 ` netdev-bot+sashiko [this message]
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=178880846466.219967.3542374542122357419@kernel.org \
--to=netdev-bot+sashiko@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=kuba@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.