Skip to content

Commit 9fea94d

Browse files
committed
tools: ynl: fix converting flags to names after recent cleanup
I recently cleaned up specs to not specify enum-as-flags when target enum is already defined as flags. YNL Python library did not convert flags, unfortunately, so this caused breakage for Stan and Willem. Note that the nlspec.py abstraction already hides the differences between flags and enums (value vs user_value), so the changes are pretty trivial. Fixes: 0629f22 ("ynl: netdev: drop unnecessary enum-as-flags") Reported-and-tested-by: Willem de Bruijn <willemb@google.com> Reported-and-tested-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/all/ZS10NtQgd_BJZ3RU@google.com/ Link: https://lore.kernel.org/r/20231016213937.1820386-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9fe1450 commit 9fea94d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/net/ynl/lib/ynl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def _add_attr(self, space, name, value):
474474

475475
def _decode_enum(self, raw, attr_spec):
476476
enum = self.consts[attr_spec['enum']]
477-
if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
477+
if enum.type == 'flags' or attr_spec.get('enum-as-flags', False):
478478
i = 0
479479
value = set()
480480
while raw:

0 commit comments

Comments
 (0)