mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>,
	"Donald Hunter" <donald.hunter@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	"Jacob Keller" <jacob.e.keller@intel.com>,
	"Stanislav Fomichev" <sdf@fomichev.me>,
	"Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
	"David Ahern" <dsahern@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	wireguard@lists.zx2c4.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net 1/4] netlink: specs: fou: change local-v6/peer-v6 check
Date: Mon,  1 Sep 2025 14:50:20 +0000	[thread overview]
Message-ID: <20250901145034.525518-2-ast@fiberby.net> (raw)
In-Reply-To: <20250901145034.525518-1-ast@fiberby.net>

While fixing the binary min-len implementaion, 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, a exact-len policy,
therefore seams like a better fit.

AFAICT this was caused by lacking support for the exact-len check
at the time of the blamed commit, which was later remedied by
c63ad379526 ("tools: ynl-gen: add support for exact-len validation").

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

Fixes: 4eb77b4ecd3c ("netlink: add a proto specification for FOU")
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/fou.yaml | 4 ++--
 net/ipv4/fou_nl.c                    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
index 57735726262ec..8e7974ec453fc 100644
--- a/Documentation/netlink/specs/fou.yaml
+++ b/Documentation/netlink/specs/fou.yaml
@@ -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
diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
index 3d9614609b2d3..506260b4a4dc2 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_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, },
 };
-- 
2.50.1


  reply	other threads:[~2025-09-01 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 14:50 [PATCH net 0/4] tools: ynl-gen: misc fixes + wireguard ynl plan Asbjørn Sloth Tønnesen
2025-09-01 14:50 ` Asbjørn Sloth Tønnesen [this message]
2025-09-01 18:50   ` [PATCH net 1/4] netlink: specs: fou: change local-v6/peer-v6 check Jakub Kicinski
2025-09-01 14:50 ` [PATCH net 2/4] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
2025-09-01 18:52   ` Jakub Kicinski
2025-09-01 21:10     ` Asbjørn Sloth Tønnesen
2025-09-01 14:50 ` [PATCH net 3/4] tools: ynl-gen: fix nested array counting Asbjørn Sloth Tønnesen
2025-09-01 18:56   ` Jakub Kicinski
2025-09-01 14:50 ` [PATCH net 4/4] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
2025-09-01 18:57   ` Jakub Kicinski

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=20250901145034.525518-2-ast@fiberby.net \
    --to=ast@fiberby.net \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=wireguard@lists.zx2c4.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®