| 153f709c | 07-Aug-2026 |
Thaison Phan <thaisonphan@google.com> |
tools: ynl: check alloc fails in generated getter code
Generated YNL getter code does not check the return value of malloc() and calloc() before passing the resulting pointer to memcpy(). This could
tools: ynl: check alloc fails in generated getter code
Generated YNL getter code does not check the return value of malloc() and calloc() before passing the resulting pointer to memcpy(). This could lead to a NULL pointer dereference on memory allocation failure.
Updated the C code generator to check for allocation failures and to return an error code in getters.
Signed-off-by: Thaison Phan <thaisonphan@google.com> Link: https://patch.msgid.link/20260807171500.7188-3-thaisonphan@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 10c90f1b | 01-Jul-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: pyynl: pull the --family resolution logic into the lib
When packaging YNL as a system level utility we added a --family argument which auto-resolves the full spec path from a well known
tools: ynl: pyynl: pull the --family resolution logic into the lib
When packaging YNL as a system level utility we added a --family argument which auto-resolves the full spec path from a well known path in /usr/share. Spelling out full YAML spec files is at this point only done in-tree, for example in the selftests which need the very latest YAML. But the selftests have their own wrapping classes for each family so test authors aren't really bothered by having to spell the paths out.
Afford the same ease of use to the Python library users. Move the path resolution from the CLI code to the library. This simplifies the pyynl use by a lot:
from pyynl import YnlFamily
ynl = YnlFamily(family="netdev")
Unless I'm missing a trick, resolving the /usr/share path is hard enough for most users to lean towards shelling out to ynl CLI with --output-json, which is sad.
The ethtool script can now use family= instead of resolving the path (the helpers are removed from cli.py so this isn't just a cleanup).
Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260701021751.3234681-3-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
| d6df5e9b | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: add --policy support
Add --policy flag which can be combined with --do or --dump to query the kernel's netlink policy for an operation instead of executing it.
Examples:
$ ynl -
tools: ynl: cli: add --policy support
Add --policy flag which can be combined with --do or --dump to query the kernel's netlink policy for an operation instead of executing it.
Examples:
$ ynl --family netdev --do dev-get --policy {'ifindex': {'max-value': 4294967295, 'min-value': 1, 'type': 'u32'}}
$ ynl --family ethtool --do channels-get --policy --output-json {"header": {"type": "nested", "policy": {"dev-index": ...}}}
$ ynl --family netdev --dump dev-get --policy {}
Link: https://patch.msgid.link/20260310005337.3594225-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 77a6401a | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add Python API for easier access to policies
The format of Netlink policy dump is a bit curious with messages in the same dump carrying both attrs and mapping info. Plus each message car
tools: ynl: add Python API for easier access to policies
The format of Netlink policy dump is a bit curious with messages in the same dump carrying both attrs and mapping info. Plus each message carries a single piece of the puzzle the caller must then reassemble.
I need to do this reassembly for a test, but I think it's generally useful. So let's add proper support to YnlFamily to return more user-friendly representation. See the various docs in the patch for more details.
Link: https://patch.msgid.link/20260310005337.3594225-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 8bbcfce5 | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: add short doc to class YnlFamily
The class is quite long. It's getting hard to find the user-facing methods. Add a short doc at the class level explaining the main API.
Link: https://pa
tools: ynl: add short doc to class YnlFamily
The class is quite long. It's getting hard to find the user-facing methods. Add a short doc at the class level explaining the main API.
Link: https://patch.msgid.link/20260310005337.3594225-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| c26fda62 | 10-Mar-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: move policy decoding out of NlMsg
We'll soon need to decode policies from dump so move _decode_policy() out of class NlMsg.
Link: https://patch.msgid.link/20260310005337.3594225-3-kuba@
tools: ynl: move policy decoding out of NlMsg
We'll soon need to decode policies from dump so move _decode_policy() out of class NlMsg.
Link: https://patch.msgid.link/20260310005337.3594225-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 60411ade | 11-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: print reply in combined format if possible
As pointed out during review of the --list-attrs support the GET ops very often return the same attrs from do and dump. Make the output mo
tools: ynl: cli: print reply in combined format if possible
As pointed out during review of the --list-attrs support the GET ops very often return the same attrs from do and dump. Make the output more readable by combining the reply information, from:
Do request attributes: - ifindex: u32 netdev ifindex
Do reply attributes: - ifindex: u32 netdev ifindex [ .. other attrs .. ]
Dump reply attributes: - ifindex: u32 netdev ifindex [ .. other attrs .. ]
To, after:
Do request attributes: - ifindex: u32 netdev ifindex
Do and Dump reply attributes: - ifindex: u32 netdev ifindex [ .. other attrs .. ]
Tested-by: Gal Pressman <gal@nvidia.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260110233142.3921386-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 6ccc421b | 11-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: extract the event/notify handling in --list-attrs
Event and notify handling is quite different from do / dump handling. Forcing it into print_mode_attrs() doesn't really buy us anyt
tools: ynl: cli: extract the event/notify handling in --list-attrs
Event and notify handling is quite different from do / dump handling. Forcing it into print_mode_attrs() doesn't really buy us anything as events and notifications do not have requests. Call print_attr_list() directly. Apart form subjective code clarity this also removes the word "reply" from the output:
Before:
Event reply attributes:
Now:
Event attributes:
Tested-by: Gal Pressman <gal@nvidia.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260110233142.3921386-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 45b99bb4 | 11-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: factor out --list-attrs / --doc handling
We'll soon add more code to the --doc handling. Factor it out to avoid making main() too long.
Tested-by: Gal Pressman <gal@nvidia.com> Ack
tools: ynl: cli: factor out --list-attrs / --doc handling
We'll soon add more code to the --doc handling. Factor it out to avoid making main() too long.
Tested-by: Gal Pressman <gal@nvidia.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260110233142.3921386-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| aca1fe23 | 11-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: add --doc as alias to --list-attrs
--list-attrs also provides information about the operation itself. So --doc seems more appropriate. Add an alias.
Tested-by: Gal Pressman <gal@nv
tools: ynl: cli: add --doc as alias to --list-attrs
--list-attrs also provides information about the operation itself. So --doc seems more appropriate. Add an alias.
Tested-by: Gal Pressman <gal@nvidia.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260110233142.3921386-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 1b7fbf62 | 11-Jan-2026 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: cli: improve --help
Improve the clarity of --help. Reorder, provide some grouping and add help messages to most of the options.
No functional changes intended.
Tested-by: Gal Pressman
tools: ynl: cli: improve --help
Improve the clarity of --help. Reorder, provide some grouping and add help messages to most of the options.
No functional changes intended.
Tested-by: Gal Pressman <gal@nvidia.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260110233142.3921386-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|