| 396786af | 11-May-2025 |
Lukas Wunner <[email protected]> |
tools: ynl-gen: Allow multi-attr without nested-attributes again
Since commit ce6cb8113c84 ("tools: ynl-gen: individually free previous values on double set"), specifying the "multi-attr" property r
tools: ynl-gen: Allow multi-attr without nested-attributes again
Since commit ce6cb8113c84 ("tools: ynl-gen: individually free previous values on double set"), specifying the "multi-attr" property raises an error unless the "nested-attributes" property is specified as well:
File "tools/net/ynl/./pyynl/ynl_gen_c.py", line 1147, in _load_nested_sets child = self.pure_nested_structs.get(nested) ^^^^^^ UnboundLocalError: cannot access local variable 'nested' where it is not associated with a value
This appears to be a bug since there are existing specs which omit "nested-attributes" on "multi-attr" attributes. Also, according to Documentation/userspace-api/netlink/specs.rst, multi-attr "is the recommended way of implementing arrays (no extra nesting)", suggesting that nesting should even be avoided in favor of multi-attr.
Fix the indentation of the if-block introduced by the commit to avoid the error.
Fixes: ce6cb8113c84 ("tools: ynl-gen: individually free previous values on double set") Signed-off-by: Lukas Wunner <[email protected]> Link: https://patch.msgid.link/d6b58684b7e5bfb628f7313e6893d0097904e1d1.1746940107.git.lukas@wunner.de Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 57e7dedf | 14-Apr-2025 |
Jakub Kicinski <[email protected]> |
tools: ynl-gen: make sure we validate subtype of array-nest
ArrayNest AKA indexed-array support currently skips inner type validation. We count the attributes and then we parse them, make sure we ca
tools: ynl-gen: make sure we validate subtype of array-nest
ArrayNest AKA indexed-array support currently skips inner type validation. We count the attributes and then we parse them, make sure we call validate, too. Otherwise buggy / unexpected kernel response may lead to crashes.
Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink") Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| ce6cb811 | 14-Apr-2025 |
Jakub Kicinski <[email protected]> |
tools: ynl-gen: individually free previous values on double set
When user calls request_attrA_set() multiple times (for the same attribute), and attrA is of type which allocates memory - we try to f
tools: ynl-gen: individually free previous values on double set
When user calls request_attrA_set() multiple times (for the same attribute), and attrA is of type which allocates memory - we try to free the previously associated values. For array types (including multi-attr) we have only freed the array, but the array may have contained pointers.
Refactor the code generation for free attr and reuse the generated lines in setters to flush out the previous state. Since setters are static inlines in the header we need to add forward declarations for the free helpers of pure nested structs. Track which types get used by arrays and include the right forwad declarations.
At least ethtool string set and bit set would not be freed without this. Tho, admittedly, overriding already set attribute twice is likely a very very rare thing to do.
Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink") Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| dfa464b4 | 14-Apr-2025 |
Jakub Kicinski <[email protected]> |
tools: ynl-gen: move local vars after the opening bracket
The "function writing helper" tries to put local variables between prototype and the opening bracket. Clearly wrong, but up until now nothin
tools: ynl-gen: move local vars after the opening bracket
The "function writing helper" tries to put local variables between prototype and the opening bracket. Clearly wrong, but up until now nothing actually uses it to write local vars so it wasn't noticed.
Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 31438709 | 11-Feb-2025 |
Donald Hunter <[email protected]> |
netlink: specs: wireless: add a spec for nl80211
Add a rudimentary YNL spec for nl80211 that covers get-wiphy, get-interface and get-protocol-features.
./tools/net/ynl/pyynl/cli.py --family nl80211
netlink: specs: wireless: add a spec for nl80211
Add a rudimentary YNL spec for nl80211 that covers get-wiphy, get-interface and get-protocol-features.
./tools/net/ynl/pyynl/cli.py --family nl80211 \ --do get-protocol-features {'protocol-features': {'split-wiphy-dump'}}
./tools/net/ynl/pyynl/cli.py --family nl80211 \ --dump get-wiphy --json '{ "split-wiphy-dump": true }'
./tools/net/ynl/pyynl/cli.py --family nl80211 \ --dump get-interface
Signed-off-by: Donald Hunter <[email protected]> Acked-by: Johannes Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 16cd1a52 | 11-Feb-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: sanitise enums with leading digits in ynl-gen-c
Turn attribute names with leading digits into valid C names by prepending an underscore, e.g. 5ghz -> _5ghz
Signed-off-by: Donald Hunt
tools/net/ynl: sanitise enums with leading digits in ynl-gen-c
Turn attribute names with leading digits into valid C names by prepending an underscore, e.g. 5ghz -> _5ghz
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 8798892b | 11-Feb-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: add s8, s16 to valid scalars in ynl-gen-c
Add the missing s8 and s16 scalar types to the list of recognised scalars in ynl-gen-c.
Signed-off-by: Donald Hunter <[email protected]
tools/net/ynl: add s8, s16 to valid scalars in ynl-gen-c
Add the missing s8 and s16 scalar types to the list of recognised scalars in ynl-gen-c.
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| c578bc3a | 11-Feb-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: accept IP string inputs
The ynl tool uses display-hint to know when to format IP addresses in printed output, but not to parse IP addresses from --json input. Add support for parsing
tools/net/ynl: accept IP string inputs
The ynl tool uses display-hint to know when to format IP addresses in printed output, but not to parse IP addresses from --json input. Add support for parsing ipv4 and ipv6 strings.
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 569a5d63 | 11-Feb-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: support rendering C array members to strings
The nl80211 family encodes the list of supported ciphers as a C array of u32 values. Add support for translating arrays of scalars into st
tools/net/ynl: support rendering C array members to strings
The nl80211 family encodes the list of supported ciphers as a C array of u32 values. Add support for translating arrays of scalars into strings for enum names and display hints.
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 678d8ddd | 11-Feb-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: support decoding indexed arrays as enums
When decoding an indexed-array with a scalar subtype, it is currently only possible to add a display-hint. Add support for decoding each value
tools/net/ynl: support decoding indexed arrays as enums
When decoding an indexed-array with a scalar subtype, it is currently only possible to add a display-hint. Add support for decoding each value as an enum.
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 0bdcfaf8 | 05-Feb-2025 |
Jakub Kicinski <[email protected]> |
tools: ynl: add all headers to makefile deps
The Makefile.deps lists uAPI headers to make the build work when system headers are older than in-tree headers. The problem doesn't occur for new headers
tools: ynl: add all headers to makefile deps
The Makefile.deps lists uAPI headers to make the build work when system headers are older than in-tree headers. The problem doesn't occur for new headers, because system headers are not there at all. But out-of-tree YNL clone on GH also uses this header to identify header dependencies, and one day the system headers will exist, and will get out of date. So let's add the headers we missed.
I don't think this is a fix, but FWIW the commits which added the missing headers are:
commit 04e65df94b31 ("netlink: spec: add shaper YAML spec") commit 49922401c219 ("ethtool: separate definitions that are gonna be generated")
Reviewed-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| e5ad1d98 | 08-Jan-2025 |
Jan Stancek <[email protected]> |
tools: ynl: add main install target
This will install C library, specs, rsts and pyynl. The initial structure is:
$ mkdir /tmp/myroot $ make DESTDIR=/tmp/myroot install
/usr /usr/lib64 /usr/l
tools: ynl: add main install target
This will install C library, specs, rsts and pyynl. The initial structure is:
$ mkdir /tmp/myroot $ make DESTDIR=/tmp/myroot install
/usr /usr/lib64 /usr/lib64/libynl.a /usr/lib/python3.XX/site-packages/pyynl/* /usr/lib/python3.XX/site-packages/pyynl-0.0.1.dist-info/* /usr/bin /usr/bin/ynl /usr/bin/ynl-ethtool /usr/include/ynl/*.h /usr/share /usr/share/doc /usr/share/doc/ynl /usr/share/doc/ynl/*.rst /usr/share/ynl /usr/share/ynl/genetlink-c.yaml /usr/share/ynl/genetlink-legacy.yaml /usr/share/ynl/genetlink.yaml /usr/share/ynl/netlink-raw.yaml /usr/share/ynl/specs /usr/share/ynl/specs/devlink.yaml /usr/share/ynl/specs/dpll.yaml /usr/share/ynl/specs/ethtool.yaml /usr/share/ynl/specs/fou.yaml /usr/share/ynl/specs/handshake.yaml /usr/share/ynl/specs/mptcp_pm.yaml /usr/share/ynl/specs/netdev.yaml /usr/share/ynl/specs/net_shaper.yaml /usr/share/ynl/specs/nfsd.yaml /usr/share/ynl/specs/nftables.yaml /usr/share/ynl/specs/nlctrl.yaml /usr/share/ynl/specs/ovs_datapath.yaml /usr/share/ynl/specs/ovs_flow.yaml /usr/share/ynl/specs/ovs_vport.yaml /usr/share/ynl/specs/rt_addr.yaml /usr/share/ynl/specs/rt_link.yaml /usr/share/ynl/specs/rt_neigh.yaml /usr/share/ynl/specs/rt_route.yaml /usr/share/ynl/specs/rt_rule.yaml /usr/share/ynl/specs/tcp_metrics.yaml /usr/share/ynl/specs/tc.yaml /usr/share/ynl/specs/team.yaml
Signed-off-by: Jan Stancek <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/c882688d751295c7f35c7d4eba104cd5174a0861.1736343575.git.jstancek@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 1b038af9 | 08-Jan-2025 |
Jan Stancek <[email protected]> |
tools: ynl: add install target for generated content
Generate docs using ynl_gen_rst and add install target for headers, specs and generates rst files.
Factor out SPECS_DIR since it's repeated many
tools: ynl: add install target for generated content
Generate docs using ynl_gen_rst and add install target for headers, specs and generates rst files.
Factor out SPECS_DIR since it's repeated many times.
Signed-off-by: Jan Stancek <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/645c68e3d201f1ef4276e3daddfe06262a0c2804.1736343575.git.jstancek@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| a12afefa | 08-Jan-2025 |
Jan Stancek <[email protected]> |
tools: ynl: add initial pyproject.toml for packaging
Add pyproject.toml and define authors, dependencies and user-facing scripts. This will be used later by pip to install python code.
Signed-off-b
tools: ynl: add initial pyproject.toml for packaging
Add pyproject.toml and define authors, dependencies and user-facing scripts. This will be used later by pip to install python code.
Signed-off-by: Jan Stancek <[email protected]> Reviewed-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/b184b43340f08aef97387bfd7f2b2cd9b015c343.1736343575.git.jstancek@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|