lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1a4da4cb54c0436d5f67efacf6866b4bc057b3e.camel@sipsolutions.net>
Date: Mon, 08 Sep 2025 09:54:03 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Asbjørn Sloth Tønnesen	
 <ast@...erby.net>, "Keller, Jacob E" <jacob.e.keller@...el.com>, "Jason A.
 Donenfeld" <Jason@...c4.com>, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>,  Jakub Kicinski	 <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>
Cc: Donald Hunter <donald.hunter@...il.com>, Simon Horman
 <horms@...nel.org>,  Andrew Lunn <andrew+netdev@...n.ch>,
 "wireguard@...ts.zx2c4.com" <wireguard@...ts.zx2c4.com>, 
 "netdev@...r.kernel.org"	 <netdev@...r.kernel.org>,
 "linux-kernel@...r.kernel.org"	 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 02/11] tools: ynl-gen: generate nested array
 policies

On Sat, 2025-09-06 at 14:13 +0000, Asbjørn Sloth Tønnesen wrote:
> 
> Johannes introduced NLA_NESTED_ARRAY and the NLA_POLICY_NESTED_ARRAY()
> macro in commit 1501d13596b9 for use in nl80211, and it's therefore
> used in net/wireless/nl80211.c, but outside of that the macro is
> only sparsely adopted (only by mac80211_hwsim.c and nf_tables_api.c).
> 
> Wireguard adopts the macro in this RFC patch:
> https://lore.kernel.org/netdev/20250904220255.1006675-2-ast@fiberby.net/

I think the general consensus now is that preference should be towards
arrays being expressed by giving the attribute holding the array
multiple times, i.e. each occurrence of an attribute holds a single
entry of the array:

[header][type1:a1][type2:b][type1:a2][type1:a3]

resulting in an array

[a1, a2, a3] and a separate value "b",

rather than a nested array:

[header][type1:[1:a1][2:a2][3:a3]][type2:b]


Of course if each entry has multiple values, then you'd still need
nesting:

[header][type1:[subtype1:x1][subtype2:x2]][type1:[subtype1:y1][subtype2:y2]]

would be an array

[[x1, x2], [y1, y2]].


I can't get rid of the nested array types in nl80211 though, of course.

I'm not sure the nl80211 ynl code was ever merged, but it wasn't
authoritative anyway, just for some limited userspace generation, so I'm
not sure the whole ynl handling this is needed at all?


johannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ