1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/tools/net/ynl
Jakub Kicinski 964417a5d4 tools: ynl: c: correct reverse decode of empty attrs
netlink reports which attribute was incorrect by sending back
an attribute offset. Offset points to the address of struct nlattr,
but to interpret the type we also need the nesting path.
Attribute IDs have different meaning in different nests
of the same message.

Correct the condition for "is the offset within current attribute".
ynl_attr_data_len() does not include the attribute header,
so the end offset was off by 4 bytes.

This means that we'd always skip over flags and empty nests.

The devmem tests, for example, issues an invalid request with
empty queue nests, resulting in the following error:

  YNL failed: Kernel error: missing attribute: .queues.ifindex

The message is incorrect, "queues" nest does not have an "ifindex"
attribute defined. With this fix we decend correctly into the nest:

  YNL failed: Kernel error: missing attribute: .queues.id

Fixes: 86878f14d7 ("tools: ynl: user space helpers")
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250124012130.1121227-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-01-27 14:30:23 -08:00
..
generated tools: ynl: add install target for generated content 2025-01-09 12:53:27 -08:00
lib tools: ynl: c: correct reverse decode of empty attrs 2025-01-27 14:30:23 -08:00
pyynl Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-01-16 10:34:59 -08:00
samples ynl: samples: Fix the wrong format specifier 2024-11-13 18:48:15 -08:00
Makefile tools: ynl: add main install target 2025-01-09 12:53:27 -08:00
Makefile.deps tcp_metrics: add netlink protocol spec in YAML 2024-07-01 09:44:27 +01:00
pyproject.toml tools: ynl: add initial pyproject.toml for packaging 2025-01-09 12:53:27 -08:00
requirements.txt tools: ynl: add the Python requirements.txt file 2023-03-24 19:11:02 -07:00
ynl-regen.sh tools: ynl: move python code to separate sub-directory 2025-01-09 12:53:27 -08:00