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]
Date: Mon, 16 Oct 2023 10:34:46 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com, 
	pabeni@...hat.com, lorenzo@...nel.org, willemb@...gle.com
Subject: Re: [PATCH net-next 1/3] ynl: netdev: drop unnecessary enum-as-flags

On 10/03, Jakub Kicinski wrote:
> enum-as-flags can be used when enum declares bit positions but
> we want to carry bitmask in an attribute. If the definition
> is already provided as flags there's no need to indicate
> the flag-iness of the attribute.

Jakub, Willem hit an issue with this commit when running cli.py:

./cli.py --spec $KDIR/Documentation/netlink/specs/netdev.yaml --dump dev-get --json='{"ifindex": 12}'

Traceback (most recent call last):
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/./cli.py", line 60, in <module>
    main()
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/./cli.py", line 51, in main
    reply = ynl.dump(args.dump, attrs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/lib/ynl.py", line 729, in dump
    return self._op(method, vals, [], dump=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/lib/ynl.py", line 714, in _op
    rsp_msg = self._decode(decoded.raw_attrs, op.attr_set.name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/lib/ynl.py", line 540, in _decode
    decoded = self._decode_enum(decoded, attr_spec)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/sdf/net-next/tools/net/ynl/lib/ynl.py", line 486, in _decode_enum
    value = enum.entries_by_val[raw].name
            ~~~~~~~~~~~~~~~~~~~^^^^^
KeyError: 127

I do see we have special handing for enum-as-flags to parse out the
individual fields:
	if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:

> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  Documentation/netlink/specs/netdev.yaml | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
> index c46fcc78fc04..14511b13f305 100644
> --- a/Documentation/netlink/specs/netdev.yaml
> +++ b/Documentation/netlink/specs/netdev.yaml
> @@ -74,7 +74,6 @@ name: netdev
>          doc: Bitmask of enabled xdp-features.
>          type: u64
>          enum: xdp-act
> -        enum-as-flags: true
>        -
>          name: xdp-zc-max-segs
>          doc: max fragment count supported by ZC driver
> @@ -87,7 +86,6 @@ name: netdev
>               See Documentation/networking/xdp-rx-metadata.rst for more details.
>          type: u64
>          enum: xdp-rx-metadata
> -        enum-as-flags: true
>  
>  operations:
>    list:
> -- 
> 2.41.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ