| 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 ...
|
| 9b6b016d | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix logic errors reported by pylint
Fix the following logic errors:
tools/net/ynl/pyynl/lib/nlspec.py:299:15: E1101: Instance of 'list' has no 'items' member (no-member)
tools/net/ynl/
tools: ynl: fix logic errors reported by pylint
Fix the following logic errors:
tools/net/ynl/pyynl/lib/nlspec.py:299:15: E1101: Instance of 'list' has no 'items' member (no-member)
tools/net/ynl/pyynl/lib/nlspec.py:580:22: E0606: Possibly using variable 'op' before assignment (possibly-used-before-assignment)
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-8-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 00ef9f15 | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix pylint global variable related warnings
Refactor to avoid using global variables to fix the following pylint issues:
- invalid-name - global-statement - global-variable-not-assigned
tools: ynl: fix pylint global variable related warnings
Refactor to avoid using global variables to fix the following pylint issues:
- invalid-name - global-statement - global-variable-not-assigned
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-7-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 542ba2de | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix pylint misc warnings
Fix pylint warnings for:
- unused-argument - consider-using-in - consider-using-get - consider-using-f-string - protected-access - unidiomatic-typecheck - no-el
tools: ynl: fix pylint misc warnings
Fix pylint warnings for:
- unused-argument - consider-using-in - consider-using-get - consider-using-f-string - protected-access - unidiomatic-typecheck - no-else-return
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-6-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 04b0b64e | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix pylint dict, indentation, long lines, uninitialised
Fix pylint warnings for:
- use-dict-literal - bad-indentation - line-too-long - possibly-used-before-assignment
Signed-off-by: D
tools: ynl: fix pylint dict, indentation, long lines, uninitialised
Fix pylint warnings for:
- use-dict-literal - bad-indentation - line-too-long - possibly-used-before-assignment
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-5-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| b6270a10 | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix pylint exception warnings
Fix pylint warnings for:
- broad-exception-raised - broad-exception-caught - raise-missing-from
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Lin
tools: ynl: fix pylint exception warnings
Fix pylint warnings for:
- broad-exception-raised - broad-exception-caught - raise-missing-from
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-4-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| bcdd8ea7 | 08-Jan-2026 |
Donald Hunter <donald.hunter@gmail.com> |
tools: ynl: fix pylint redefinition, encoding errors
Fix pylint warnings for:
- invalid-name - arguments-renamed - redefined-outer-name - unspecified-encoding - consider-using-sys-exit
Signed-off-
tools: ynl: fix pylint redefinition, encoding errors
Fix pylint warnings for:
- invalid-name - arguments-renamed - redefined-outer-name - unspecified-encoding - consider-using-sys-exit
Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20260108161339.29166-3-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 34164142 | 27-Oct-2025 |
Jakub Kicinski <kuba@kernel.org> |
tools: ynl: rework the string representation of NlError
In early days of YNL development dumping the NlMsg on errors was quite useful, as the library itself could have been buggy. These days increas
tools: ynl: rework the string representation of NlError
In early days of YNL development dumping the NlMsg on errors was quite useful, as the library itself could have been buggy. These days increasingly the NlMsg is just taking up screen space and means nothing to a typical user. Try to format the errors more in line with how YNL C formats its errors strings.
Before: $ ynl --family ethtool --do channels-set --json '{}' Netlink error: Invalid argument nl_len = 44 (28) nl_flags = 0x300 nl_type = 2 error: -22 extack: {'miss-type': 'header'}
$ ynl --family ethtool --do channels-set --json '{..., "tx-count": 999}' Netlink error: Invalid argument nl_len = 88 (72) nl_flags = 0x300 nl_type = 2 error: -22 extack: {'msg': 'requested channel count exceeds maximum', 'bad-attr': '.tx-count'}
After: $ ynl --family ethtool --do channels-set --json '{}' Netlink error: Invalid argument {'miss-type': 'header'}
$ ynl --family ethtool --do channels-set --json '{..., "tx-count": 999}' Netlink error: requested channel count exceeds maximum: Invalid argument {'bad-attr': '.tx-count'}
Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20251027192958.2058340-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 1b255e1b | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: add ipv4-or-v6 display hint
The attribute WGALLOWEDIP_A_IPADDR can contain either an IPv4 or an IPv6 address depending on WGALLOWEDIP_A_FAMILY, however in practice it is enough to look a
tools: ynl: add ipv4-or-v6 display hint
The attribute WGALLOWEDIP_A_IPADDR can contain either an IPv4 or an IPv6 address depending on WGALLOWEDIP_A_FAMILY, however in practice it is enough to look at the attribute length.
This patch implements an ipv4-or-v6 display hint, that can deal with this kind of attribute.
It only implements this display hint for genetlink-legacy, it can be added to other protocol variants if needed, but we don't want to encourage it's use.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-12-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 52550d51 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: decode hex input
This patch adds support for decoding hex input, so that binary attributes can be read through --json.
Example (using future wireguard.yaml): $ sudo ./tools/net/ynl/pyy
tools: ynl: decode hex input
This patch adds support for decoding hex input, so that binary attributes can be read through --json.
Example (using future wireguard.yaml): $ sudo ./tools/net/ynl/pyynl/cli.py --family wireguard \ --do set-device --json '{"ifindex":3, "private-key":"2a ae 6c 35 c9 4f cf <... to 32 bytes>"}'
In order to somewhat mirror what is done in _formatted_string(), then for non-binary attributes attempt to convert it to an int.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-11-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 5c51ae24 | 15-Sep-2025 |
Asbjørn Sloth Tønnesen <ast@fiberby.net> |
tools: ynl: encode indexed-arrays
This patch adds support for encoding indexed-array attributes with sub-type nest in pyynl.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Don
tools: ynl: encode indexed-arrays
This patch adds support for encoding indexed-array attributes with sub-type nest in pyynl.
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250915144301.725949-10-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
| 10d32b0d | 09-Sep-2025 |
Matthieu Baerts (NGI0) <matttbe@kernel.org> |
tools: ynl: use 'cond is None'
It is better to use the 'is' keyword instead of comparing to None according to Ruff.
This is linked to Ruff error E711 [1]:
According to PEP 8, "Comparisons to sin
tools: ynl: use 'cond is None'
It is better to use the 'is' keyword instead of comparing to None according to Ruff.
This is linked to Ruff error E711 [1]:
According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators."
Link: https://docs.astral.sh/ruff/rules/none-comparison/ [1] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-7-238c2bccdd99@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|