linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] tools: ynl-gen: misc changes
@ 2025-09-02 15:46 Asbjørn Sloth Tønnesen
  2025-09-02 15:46 ` [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2025-09-02 15:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Asbjørn Sloth Tønnesen, Donald Hunter, Simon Horman,
	Jacob Keller, Matthieu Baerts (NGI0), David Ahern, Chuck Lever,
	netdev, linux-kernel

Misc changes to ahead of wireguard ynl conversion, as
announced in v1.

---
v2:
  - Rewrite commit messages for net-next
v1: https://lore.kernel.org/netdev/20250901145034.525518-1-ast@fiberby.net

Asbjørn Sloth Tønnesen (3):
  netlink: specs: fou: change local-v6/peer-v6 check
  tools: ynl-gen: use macro for binary min-len check
  genetlink: fix typo in comment

 Documentation/netlink/specs/fou.yaml | 4 ++--
 include/net/genetlink.h              | 2 +-
 net/ipv4/fou_nl.c                    | 4 ++--
 tools/net/ynl/pyynl/ynl_gen_c.py     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.50.1


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

* [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check
  2025-09-02 15:46 [PATCH net-next v2 0/3] tools: ynl-gen: misc changes Asbjørn Sloth Tønnesen
@ 2025-09-02 15:46 ` Asbjørn Sloth Tønnesen
  2025-09-03  8:32   ` Donald Hunter
  2025-09-02 15:46 ` [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
  2025-09-02 15:46 ` [PATCH net-next v2 3/3] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
  2 siblings, 1 reply; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2025-09-02 15:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Asbjørn Sloth Tønnesen, Donald Hunter, Simon Horman,
	Jacob Keller, Matthieu Baerts (NGI0), David Ahern, Chuck Lever,
	netdev, linux-kernel

While updating the binary min-len implementation, 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, and there are AFAICT
no known implementations trying to send more, it therefore
appears safe to change it to an exact-len policy.

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

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


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

* [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check
  2025-09-02 15:46 [PATCH net-next v2 0/3] tools: ynl-gen: misc changes Asbjørn Sloth Tønnesen
  2025-09-02 15:46 ` [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
@ 2025-09-02 15:46 ` Asbjørn Sloth Tønnesen
  2025-09-03  8:52   ` Donald Hunter
  2025-09-02 15:46 ` [PATCH net-next v2 3/3] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
  2 siblings, 1 reply; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2025-09-02 15:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Asbjørn Sloth Tønnesen, Donald Hunter, Simon Horman,
	Jacob Keller, Matthieu Baerts (NGI0), David Ahern, Chuck Lever,
	netdev, linux-kernel

This patch changes the generated min-len check for binary
attributes to use the NLA_POLICY_MIN_LEN() macro, thereby the
generated code supports strict policy validation.

With this change TypeBinary will always generate a NLA_BINARY
attribute policy.

This doesn't change any currently generated code, as it isn't
used in any specs currently used for generating code.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 tools/net/ynl/pyynl/ynl_gen_c.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index ef032e17fec44..52f955ed84a7f 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -556,7 +556,7 @@ class TypeBinary(Type):
         elif 'exact-len' in self.checks:
             mem = 'NLA_POLICY_EXACT_LEN(' + self.get_limit_str('exact-len') + ')'
         elif 'min-len' in self.checks:
-            mem = '{ .len = ' + self.get_limit_str('min-len') + ', }'
+            mem = 'NLA_POLICY_MIN_LEN(' + self.get_limit_str('min-len') + ')'
         elif 'max-len' in self.checks:
             mem = 'NLA_POLICY_MAX_LEN(' + self.get_limit_str('max-len') + ')'
 
-- 
2.50.1


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

* [PATCH net-next v2 3/3] genetlink: fix typo in comment
  2025-09-02 15:46 [PATCH net-next v2 0/3] tools: ynl-gen: misc changes Asbjørn Sloth Tønnesen
  2025-09-02 15:46 ` [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
  2025-09-02 15:46 ` [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
@ 2025-09-02 15:46 ` Asbjørn Sloth Tønnesen
  2025-09-03  8:52   ` Donald Hunter
  2 siblings, 1 reply; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2025-09-02 15:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Asbjørn Sloth Tønnesen, Donald Hunter, Simon Horman,
	Jacob Keller, Matthieu Baerts (NGI0), David Ahern, Chuck Lever,
	netdev, linux-kernel

In this context "not that ..." should properly be "note that ...".

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 include/net/genetlink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index a03d567658328..7b84f2cef8b1f 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -62,7 +62,7 @@ struct genl_info;
  * @small_ops: the small-struct operations supported by this family
  * @n_small_ops: number of small-struct operations supported by this family
  * @split_ops: the split do/dump form of operation definition
- * @n_split_ops: number of entries in @split_ops, not that with split do/dump
+ * @n_split_ops: number of entries in @split_ops, note that with split do/dump
  *	ops the number of entries is not the same as number of commands
  * @sock_priv_size: the size of per-socket private memory
  * @sock_priv_init: the per-socket private memory initializer
-- 
2.50.1


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

* Re: [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check
  2025-09-02 15:46 ` [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
@ 2025-09-03  8:32   ` Donald Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Donald Hunter @ 2025-09-03  8:32 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jacob Keller, Matthieu Baerts (NGI0), David Ahern,
	Chuck Lever, netdev, linux-kernel

Asbjørn Sloth Tønnesen <ast@fiberby.net> writes:

> While updating the binary min-len implementation, 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, and there are AFAICT
> no known implementations trying to send more, it therefore
> appears safe to change it to an exact-len policy.
>
> This patch therefore changes the local-v6/peer-v6 attributes to
> use an exact-len check, instead of a min-len check.
>
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

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

* Re: [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check
  2025-09-02 15:46 ` [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
@ 2025-09-03  8:52   ` Donald Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Donald Hunter @ 2025-09-03  8:52 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jacob Keller, Matthieu Baerts (NGI0), David Ahern,
	Chuck Lever, netdev, linux-kernel

Asbjørn Sloth Tønnesen <ast@fiberby.net> writes:

> This patch changes the generated min-len check for binary
> attributes to use the NLA_POLICY_MIN_LEN() macro, thereby the
> generated code supports strict policy validation.
>
> With this change TypeBinary will always generate a NLA_BINARY
> attribute policy.
>
> This doesn't change any currently generated code, as it isn't
> used in any specs currently used for generating code.
>
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

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

* Re: [PATCH net-next v2 3/3] genetlink: fix typo in comment
  2025-09-02 15:46 ` [PATCH net-next v2 3/3] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
@ 2025-09-03  8:52   ` Donald Hunter
  0 siblings, 0 replies; 7+ messages in thread
From: Donald Hunter @ 2025-09-03  8:52 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jacob Keller, Matthieu Baerts (NGI0), David Ahern,
	Chuck Lever, netdev, linux-kernel

Asbjørn Sloth Tønnesen <ast@fiberby.net> writes:

> In this context "not that ..." should properly be "note that ...".
>
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

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

end of thread, other threads:[~2025-09-03  9:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 15:46 [PATCH net-next v2 0/3] tools: ynl-gen: misc changes Asbjørn Sloth Tønnesen
2025-09-02 15:46 ` [PATCH net-next v2 1/3] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
2025-09-03  8:32   ` Donald Hunter
2025-09-02 15:46 ` [PATCH net-next v2 2/3] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
2025-09-03  8:52   ` Donald Hunter
2025-09-02 15:46 ` [PATCH net-next v2 3/3] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
2025-09-03  8:52   ` Donald Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).