aboutsummaryrefslogtreecommitdiffstats
path: root/tools/net/ynl/pyynl/lib/ynl.py
diff options
context:
space:
mode:
authorDonald Hunter <[email protected]>2025-02-11 12:01:19 +0000
committerJakub Kicinski <[email protected]>2025-02-13 03:32:03 +0000
commit678d8ddd0087a533c8eb06eabd0e3d25c02fcead (patch)
treee3d0e90b4e287eb310ed1cb7cc771f620f3a8b7b /tools/net/ynl/pyynl/lib/ynl.py
parenttools/net/ynl: remove extraneous plural from variable names (diff)
downloadkernel-678d8ddd0087a533c8eb06eabd0e3d25c02fcead.tar.gz
kernel-678d8ddd0087a533c8eb06eabd0e3d25c02fcead.zip
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]>
Diffstat (limited to 'tools/net/ynl/pyynl/lib/ynl.py')
-rw-r--r--tools/net/ynl/pyynl/lib/ynl.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py
index 8b39d8b1eaa8..b73e07f1f60c 100644
--- a/tools/net/ynl/pyynl/lib/ynl.py
+++ b/tools/net/ynl/pyynl/lib/ynl.py
@@ -650,7 +650,9 @@ class YnlFamily(SpecFamily):
decoded.append(subattr)
elif attr_spec["sub-type"] in NlAttr.type_formats:
subattr = item.as_scalar(attr_spec['sub-type'], attr_spec.byte_order)
- if attr_spec.display_hint:
+ if 'enum' in attr_spec:
+ subattr = self._decode_enum(subattr, attr_spec)
+ elif attr_spec.display_hint:
subattr = self._formatted_string(subattr, attr_spec.display_hint)
decoded.append(subattr)
else: