netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Cc: Donald Hunter <donald.hunter@gmail.com>,
	Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>, <wireguard@lists.zx2c4.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH net-next 06/11] tools: ynl-gen: don't validate nested array attribute types
Date: Wed, 10 Sep 2025 09:58:37 -0700	[thread overview]
Message-ID: <7fff6b2f-f17e-4179-8507-397b76ea24bb@intel.com> (raw)
In-Reply-To: <d612ce20-ae4a-4f6d-9d1b-a3d56f3d10a9@fiberby.net>


[-- Attachment #1.1: Type: text/plain, Size: 2876 bytes --]



On 9/6/2025 8:10 AM, Asbjørn Sloth Tønnesen wrote:
> CC: Johannes
> 
> On 9/6/25 12:24 AM, Jacob Keller wrote:
>> On 9/4/2025 3:01 PM, Asbjørn Sloth Tønnesen wrote:
>>> In nested arrays don't require that the intermediate
>>> attribute type should be a valid attribute type, it
>>> might just be an index or simple 0, it is often not
>>> even used.
>>>
>>> See include/net/netlink.h about NLA_NESTED_ARRAY:
>>>> The difference to NLA_NESTED is the structure:
>>>> NLA_NESTED has the nested attributes directly inside
>>>> while an array has the nested attributes at another
>>>> level down and the attribute types directly in the
>>>> nesting don't matter.
>>>
>>
>> To me, it would seem like it makes more sense to define these (even if
>> thats defined per family?) than to just say they aren't defined at all?
>>
>> Hm.
> 
> I considered adding some of that metadata too, as I am actually removing
> it for wireguard (in comment form, but still).
> 
> In include/uapi/linux/wireguard.h in the comment block at the top, it is
> very clear that wireguard only used type 0 for all the nested array
> entries, however the truth is that it doesn't care. It therefore doesn't
> matter if the generated -user.* keeps track of the index in .idx, or that
> cli.py decodes a JSON array and sends it with indexes, it's not needed,
> but it still works.
> 
> In practice I don't think we will break any clients if we enforced it, and
> validated that wireguard only accepts type 0 entries, in it's nested arrays.
> 
> For the other families, I don't know how well defined it is, Johannes have
> stated that nl80211 doesn't care which types are used, but I have no idea
> how consistent clients have abused that statement to send random data,
> or do they all just send zeros?
> 

Changing it at this point could be a significant backwards compat break,
as some clients might somehow send data that wasn't zero-initialized,
and checking would break them. At this point I guess it makes sense to
leave it as is... It would increase code cost and complexity for no gain.

> This would make a lot more sense if 'array-nest' hadn't been renamed to
> 'indexed-array' in ynl, because it feels wrong to add 'unindexed: true' now.
> We could also call it 'all-zero-indexed: true'.
> 
> In cli.py this gives some extra issues, as seen in [1], the nested arrays
> are outputted as '[{0: {..}}, {0: {..}}, ..]', but on input has the format
> '[{..},{..}, ..]' because it has to be JSON-compatible on input.
> 
> If we had an attribute like 'all-zero-indexed' then cli.py, could also output
> '[{..},{..}, ..]'.
> 

This part would be cool. If we know the index is "uninteresting",
eliding it so that the input and output formats match is good.

> [1] https://lore.kernel.org/netdev/20250904220255.1006675-3-ast@fiberby.net/


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  parent reply	other threads:[~2025-09-10 16:58 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 22:01 [PATCH net-next 00/11] tools: ynl: prepare for wireguard Asbjørn Sloth Tønnesen
2025-09-04 22:01 ` [PATCH net-next 01/11] tools: ynl-gen: allow overriding name-prefix for constants Asbjørn Sloth Tønnesen
2025-09-05 10:36   ` Donald Hunter
2025-09-06  0:07   ` Jakub Kicinski
2025-09-06  0:15   ` Jacob Keller
2025-09-04 22:01 ` [PATCH net-next 02/11] tools: ynl-gen: generate nested array policies Asbjørn Sloth Tønnesen
2025-09-05 10:37   ` Donald Hunter
2025-09-06  0:09   ` Jakub Kicinski
2025-09-06  0:19   ` Jacob Keller
2025-09-06 14:13     ` Asbjørn Sloth Tønnesen
2025-09-08  7:54       ` Johannes Berg
2025-09-08  9:08         ` Asbjørn Sloth Tønnesen
2025-09-08 13:22           ` Johannes Berg
2025-09-09 23:02       ` Jacob Keller
2025-09-04 22:01 ` [PATCH net-next 03/11] tools: ynl-gen: add sub-type check Asbjørn Sloth Tønnesen
2025-09-05 10:37   ` Donald Hunter
2025-09-06  0:12   ` Jakub Kicinski
2025-09-06  0:20   ` Jacob Keller
2025-09-04 22:01 ` [PATCH net-next 04/11] tools: ynl-gen: define count iterator in print_dump() Asbjørn Sloth Tønnesen
2025-09-05 10:37   ` Donald Hunter
2025-09-06  0:13   ` Jakub Kicinski
2025-09-06  0:20   ` Jacob Keller
2025-09-04 22:01 ` [PATCH net-next 05/11] tools: ynl-gen: define nlattr *array in a block scope Asbjørn Sloth Tønnesen
2025-09-05 10:44   ` Donald Hunter
2025-09-06  0:18   ` Jakub Kicinski
2025-09-06 13:13     ` Asbjørn Sloth Tønnesen
2025-09-06 19:07       ` Jakub Kicinski
2025-09-11  0:01         ` Asbjørn Sloth Tønnesen
2025-09-11  0:27           ` Jakub Kicinski
2025-09-04 22:01 ` [PATCH net-next 06/11] tools: ynl-gen: don't validate nested array attribute types Asbjørn Sloth Tønnesen
2025-09-06  0:23   ` Jakub Kicinski
2025-09-06 13:22     ` Asbjørn Sloth Tønnesen
2025-09-06 19:29       ` Jakub Kicinski
2025-09-06  0:24   ` Jacob Keller
2025-09-06 15:10     ` Asbjørn Sloth Tønnesen
2025-09-08  7:55       ` Johannes Berg
2025-09-10 16:58       ` Jacob Keller [this message]
2025-09-04 22:01 ` [PATCH net-next 07/11] tools: ynl-gen: rename TypeArrayNest to TypeIndexedArray Asbjørn Sloth Tønnesen
2025-09-05 10:44   ` Donald Hunter
2025-09-06  0:25   ` Jakub Kicinski
2025-09-04 22:01 ` [PATCH net-next 08/11] tools: ynl: move nest packing to a helper function Asbjørn Sloth Tønnesen
2025-09-05 10:45   ` Donald Hunter
2025-09-04 22:01 ` [PATCH net-next 09/11] tools: ynl: encode indexed-array Asbjørn Sloth Tønnesen
2025-09-05 10:49   ` Donald Hunter
2025-09-05 15:34     ` Asbjørn Sloth Tønnesen
2025-09-04 22:01 ` [PATCH net-next 10/11] tools: ynl: decode hex input Asbjørn Sloth Tønnesen
2025-09-05 10:51   ` Donald Hunter
2025-09-06  0:27     ` Jacob Keller
2025-09-06 14:31       ` Asbjørn Sloth Tønnesen
2025-09-08  8:28         ` Donald Hunter
2025-09-09 18:10   ` Sabrina Dubroca
2025-09-09 20:18     ` Asbjørn Sloth Tønnesen
2025-09-04 22:01 ` [PATCH net-next 11/11] tools: ynl: add ipv4-or-v6 display hint Asbjørn Sloth Tønnesen
2025-09-05 10:53   ` Donald Hunter
2025-09-06 15:59     ` Asbjørn Sloth Tønnesen

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=7fff6b2f-f17e-4179-8507-397b76ea24bb@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=Jason@zx2c4.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@fiberby.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).