[PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y
flat view
HOTtoday
From: Anton Danilov <hidden>
Date: 2026-10-10 03:51:32
Also in:
stable
Two 6.12.y backports added YNL spec features that the 6.12.y YNL tools
do not support:
- 6.12.93: a2de9c7f01b3 ("net/handshake: Pass negative errno through
handshake_complete()") adds a "scope: kernel" definition to
handshake.yaml and uses it in "checks: max";
- 6.12.111: 45ca9f59b6c7 ("net: reject oversized tx_queue_len at
netlink parse time") adds "checks: max" to rt_link.yaml, which
netlink-raw.yaml does not allow.
Since 6.12.93 "make -C tools/net/ynl" fails on handshake:
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('scope' was unexpected)
and since 6.12.111 the in-tree CLI fails on rt_link:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/rt_link.yaml --dump getlink
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('max' was unexpected)
Greg queued fbf5df34a4db ("tools: ynl: add scope qualifier for
definitions") for newer trees and asked for a 6.12.y backport in
https://lore.kernel.org/all/2026060807-egging-prune-a3ae@gregkh/ (local)
fbf5df34a4db alone is not enough: handshake.yaml then fails on the
constant name in "checks: max", and the 6.12.y generator cannot
resolve such names. Patches 1 and 2 add that, patch 3 is fbf5df34a4db.
Patch 4 is bf5a54bc0e3d ("doc/netlink: netlink-raw: Add max check"),
requested for 6.18.y in
https://lore.kernel.org/all/899bd843-fd19-418e-8913-91bfb6e760a2@linux.microsoft.com/ (local)
Patches 2-4 carry the upstream changes as is; in 6.12.y the generator
is tools/net/ynl/ynl-gen-c.py. Patch 1 needed adjustments, they are
described in its commit message. Like upstream, it also updates the
generated net/core/netdev-genl-gen.c (4294967295ULL -> U32_MAX,
2147483647ULL -> S32_MAX); the object file is byte-identical before
and after (x86_64 defconfig).
Tested on top of v6.12.112:
- all 19 specs validate against their schemas (2 fail before);
- make -C tools/net/ynl builds without warnings (fails before);
- tools/net/ynl/ynl-regen.sh -f regenerates all 24 generated kernel
and uAPI files with no changes, net/handshake/genl.c included;
- cli.py --spec rt_link.yaml --dump getlink works.
Jakub Kicinski (3):
tools: ynl-gen: use names of constants in generated limits
tools: ynl-gen: support limits using definitions
tools: ynl: add scope qualifier for definitions
Remy D. Farley (1):
doc/netlink: netlink-raw: Add max check
Documentation/netlink/genetlink-c.yaml | 14 ++++-
Documentation/netlink/genetlink-legacy.yaml | 14 ++++-
Documentation/netlink/genetlink.yaml | 14 ++++-
Documentation/netlink/netlink-raw.yaml | 20 +++++-
net/core/netdev-genl-gen.c | 4 +-
tools/net/ynl/ynl-gen-c.py | 70 ++++++++++++++++-----
6 files changed, 112 insertions(+), 24 deletions(-)
--
2.47.3