linux/tools/net/ynl/lib
Donald Hunter bd3ce405fe tools/net/ynl: Add extack policy attribute decoding
The NLMSGERR_ATTR_POLICY extack attribute has been ignored by ynl up to
now. Extend extack decoding to include _POLICY and the nested
NL_POLICY_TYPE_ATTR_* attributes.

For example:

./tools/net/ynl/cli.py \
  --spec Documentation/netlink/specs/rt_link.yaml \
  --create --do newlink --json '{
    "ifname": "12345678901234567890",
    "linkinfo": {"kind": "bridge"}
    }'
Netlink error: Numerical result out of range
nl_len = 104 (88) nl_flags = 0x300 nl_type = 2
	error: -34	extack: {'msg': 'Attribute failed policy validation',
'policy': {'max-length': 15, 'type': 'string'}, 'bad-attr': '.ifname'}

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20240328155636.64688-1-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-03-29 12:26:02 -07:00
..
__init__.py tools/net/ynl: Report netlink errors without stacktrace 2024-03-07 20:28:26 -08:00
.gitignore tools: net: add __pycache__ to gitignore 2023-02-24 11:55:47 -08:00
Makefile tools: ynl: remove __pycache__ during clean 2024-03-06 12:05:10 +00:00
nlspec.py netlink: specs: support generating code for genl socket priv 2024-03-11 15:15:42 -07:00
ynl-priv.h tools: ynl: check for overflow of constructed messages 2024-03-07 11:01:31 -08:00
ynl.c tools: ynl: Fix spelling mistake "Constructred" -> "Constructed" 2024-03-08 19:58:13 -08:00
ynl.h tools: ynl: check for overflow of constructed messages 2024-03-07 11:01:31 -08:00
ynl.py tools/net/ynl: Add extack policy attribute decoding 2024-03-29 12:26:02 -07:00