Skip to content

tools: ynl: fix spec validation in 6.12.y

Anton Danilov linux-kbuild linux-patches lkml netdev stable 1 version Applied

Status from this message: Queued the series for 6.12, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4tools: ynl-gen: use names of constants in generated limitsnet/core/netdev-genl-gen.c tools/net/ynl/ynl-gen-c.py+25 -150 replies
2/4tools: ynl-gen: support limits using definitionsDocumentation/netlink/genetlink-c.yaml Documentation/netlink/genetlink-legacy.yaml Documentation/netlink/genetlink.yaml +1 more+13 -70 replies
3/4tools: ynl: add scope qualifier for definitionsDocumentation/netlink/genetlink-c.yaml Documentation/netlink/genetlink-legacy.yaml Documentation/netlink/genetlink.yaml +2 more+65 -20 replies
4/4doc/netlink: netlink-raw: Add max checkDocumentation/netlink/netlink-raw.yaml+10 -10 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchJoe DamatoDonald Hunter
1/4R-b
2/4
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 6.12.y 0/4] tools: ynl: fix spec validation in 6.12.y

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/
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/[email protected]/

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(-)
Signature · 1 line
2.47.3