lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2jyzomypp.fsf@gmail.com>
Date: Mon, 17 Nov 2025 16:05:22 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Gal Pressman <gal@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>,  Eric Dumazet
 <edumazet@...gle.com>,  Jakub Kicinski <kuba@...nel.org>,  Paolo Abeni
 <pabeni@...hat.com>,  Andrew Lunn <andrew+netdev@...n.ch>,
  <netdev@...r.kernel.org>,  Simon Horman <horms@...nel.org>,  Alexei
 Starovoitov <ast@...nel.org>,  Daniel Borkmann <daniel@...earbox.net>,
  Jesper Dangaard Brouer <hawk@...nel.org>,  John Fastabend
 <john.fastabend@...il.com>,  Stanislav Fomichev <sdf@...ichev.me>,
  <bpf@...r.kernel.org>,  Nimrod Oren <noren@...dia.com>
Subject: Re: [PATCH net-next 3/3] tools: ynl: cli: Display enum values in
 --list-attrs output

Gal Pressman <gal@...dia.com> writes:

> When listing attributes with --list-attrs, display the actual enum
> values for attributes that reference an enum type.
>
>   # ./cli.py --family netdev --list-attrs dev-get
>   [..]
>     - xdp-features: u64 (enum: xdp-act)
>       Values: basic, redirect, ndo-xmit, xsk-zerocopy, hw-offload, rx-sg, ndo-xmit-sg
>       Bitmask of enabled xdp-features.
>   [..]
>
> Reviewed-by: Nimrod Oren <noren@...dia.com>
> Signed-off-by: Gal Pressman <gal@...dia.com>
> ---
>  tools/net/ynl/pyynl/cli.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/net/ynl/pyynl/cli.py b/tools/net/ynl/pyynl/cli.py
> index 3389e552ec4e..d305add514cd 100755
> --- a/tools/net/ynl/pyynl/cli.py
> +++ b/tools/net/ynl/pyynl/cli.py
> @@ -139,7 +139,12 @@ def main():
>                  attr = attr_set.attrs[attr_name]
>                  attr_info = f'{prefix}- {attr_name}: {attr.type}'
>                  if 'enum' in attr.yaml:
> -                    attr_info += f" (enum: {attr.yaml['enum']})"
> +                    enum_name = attr.yaml['enum']
> +                    attr_info += f" (enum: {enum_name})"

Would be good to say enum | flags so that people know what semantics are valid.

> +                    # Print enum values if available
> +                    if enum_name in ynl.consts:
> +                        enum_values = list(ynl.consts[enum_name].entries.keys())
> +                        attr_info += f"\n{prefix}  Values: {', '.join(enum_values)}"

This produces quite noisy output for e.g.

./tools/net/ynl/pyynl/cli.py --family ethtool --list-attrs rss-get

Not sure what to suggest to improve readability but maybe it doesn't
need 'Values:' or commas, or perhaps only output each enum once?

>  
>                  # Show nested attributes reference and recursively display them
>                  nested_set_name = None

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ