| 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 ...
|
| 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 ...
|
| b1b62d6d | 11-Jan-2025 |
Donald Hunter <[email protected]> |
tools/net/ynl: ethtool: support spec load from install location
Replace hard-coded paths for spec and schema with lookup functions so that ethtool.py will work in-tree or when installed.
Signed-off
tools/net/ynl: ethtool: support spec load from install location
Replace hard-coded paths for spec and schema with lookup functions so that ethtool.py will work in-tree or when installed.
Signed-off-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|