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: <m2sf10g9g6.fsf@gmail.com>
Date: Fri, 08 Mar 2024 13:05:45 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org,  "David S. Miller" <davem@...emloft.net>,  Eric
 Dumazet <edumazet@...gle.com>,  Jakub Kicinski <kuba@...nel.org>,  Paolo
 Abeni <pabeni@...hat.com>,  Jacob Keller <jacob.e.keller@...el.com>,  Jiri
 Pirko <jiri@...nulli.us>
Subject: Re: [PATCH net-next] doc/netlink/specs: Add vlan attr in rt_link spec

Hangbin Liu <liuhangbin@...il.com> writes:

> With command:
>  # ./tools/net/ynl/cli.py \
>  --spec Documentation/netlink/specs/rt_link.yaml \
>  --do getlink --json '{"ifname": "eno1.2"}'
>
> Before:
> Exception: No message format for 'vlan' in sub-message spec 'linkinfo-data-msg'
>
> After:
>  'linkinfo': {'data': {'flag': {'flags': {'bridge-binding',
>                                           'gvrp',
>                                           'reorder-hdr'},
>                                 'mask': 4294967295},
>                        'id': 2,
>                        'protocol': 129},
>               'kind': 'vlan'},
>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
> Not sure if there is a proper way to show the mask and protocol

Using display-hint, e.g. display-hint: hex, is intended to tell the ynl
cli to render output in a human readable way. Unfortunately it currently
only works for binary attributes.

It can be done like this:

      -
        name: mask
        type: binary
        len: 4
        display-hint: hex

./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/rt_link.yaml \
--do getlink --json '{"ifname": "wlan0.8"}' --output-json | jq -C '.linkinfo'
{
  "kind": "vlan",
  "data": {
    "protocol": 33024,
    "id": 8,
    "flag": {
      "flags": [
        "reorder-hdr"
      ],
      "mask": "ff ff ff ff"
    }
  }
}

But it seems wrong to change the struct definition for this. We should
patch ynl to support hex rendering of integers.

For the protocol, you'd need to add an enum of ethernet protocol
numbers, from the info in include/uapi/linux/if_ether.h

> +  -
> +    name: linkinfo-vlan-attrs
> +    name-prefix: ifla-vlan-
> +    attributes:
> +      -
> +        name: id
> +        type: u16
> +      -
> +        name: flag
> +        type: binary
> +        struct: ifla-vlan-flags
> +      -
> +        name: egress-qos
> +        type: nest
> +        nested-attributes: ifla-vlan-qos
> +      -
> +        name: ingress-qos
> +        type: nest
> +        nested-attributes: ifla-vlan-qos
> +      -
> +        name: protocol
> +        type: u16

The protocol value is in big endian format, so it is actually 33024
(0x8100) not 129. You need to add byte-order: big-endian

> +  -
> +    name: ifla-vlan-qos
> +    name-prefix: ifla-vlan-qos
> +    attributes:
> +      -
> +        name: mapping
> +        type: binary
> +        struct: ifla-vlan-qos-mapping
>    -
>      name: linkinfo-vrf-attrs
>      name-prefix: ifla-vrf-
> @@ -1666,6 +1732,9 @@ sub-messages:
>        -
>          value: tun
>          attribute-set: linkinfo-tun-attrs
> +      -
> +        value: vlan
> +        attribute-set: linkinfo-vlan-attrs
>        -
>          value: vrf
>          attribute-set: linkinfo-vrf-attrs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ