Re: [PATCH net-next 02/11] tools: ynl-gen: generate nested array policies

Jacob Keller <[email protected]>
Newsgroups com.zx2c4.lists.wireguard,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>

On 9/4/2025 3:01 PM, Asbjørn Sloth Tønnesen wrote:
> This patch adds support for NLA_POLICY_NESTED_ARRAY() policies.
> 
> Example spec (from future wireguard.yaml):
> -
>   name: wgpeer
>   attributes:
>     -
>       name: allowedips
>       type: indexed-array
>       sub-type: nest
>       nested-attributes: wgallowedip
> 
> yields NLA_POLICY_NESTED_ARRAY(wireguard_wgallowedip_nl_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 <[email protected]>
> ---

Is this keyed of off the sub-type? Does you mean that all the existing
uses of 'sub-type: nest' don't generate code today? Or that this
_attr_policy implementation is not called yet?

I checked and we have quite a number of uses:

> $ rg 'sub-type: nest'
> Documentation/netlink/specs/nlctrl.yaml
> 69:        sub-type: nest
> 74:        sub-type: nest
> 
> Documentation/netlink/specs/tc.yaml
> 2045:        sub-type: nest
> 2065:        sub-type: nest
> 2190:        sub-type: nest
> 2304:        sub-type: nest
> 2494:        sub-type: nest
> 3021:        sub-type: nest
> 3181:        sub-type: nest
> 3567:        sub-type: nest
> 3799:        sub-type: nest
> 
> Documentation/netlink/specs/rt-link.yaml
> 2203:        sub-type: nest
> 
> Documentation/netlink/specs/nl80211.yaml
> 610:        sub-type: nest
> 1309:        sub-type: nest
> 1314:        sub-type: nest
> 1337:        sub-type: nest
> 1420:        sub-type: nest
> 1476:        sub-type: nest
> 1615:        sub-type: nest
>
OpenPGP_signature.asc (application/pgp-signature, 236 B)
-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQQgQFSp1zOQVirsQx5qll0+bw8o6AUCaLt+FQUDAAAAAAAKCRBqll0+bw8o6Bld
AQDdKDMJeuqdrANp4tIms7Rq7D2fDW3MnplTx7xEwp93ngD6A4JiIHDBvazIvKyYPaDPP+FOBRgS
myi8njPVNrkngQY=
=8lVf
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.