[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200730193130.jemdjrqe2qkfo5uh@lion.mk-sys.cz>
Date: Thu, 30 Jul 2020 21:31:30 +0200
From: Michal Kubecek <mkubecek@...e.cz>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
Jamie Gloudon <jamie.gloudon@....fr>
Subject: Re: [ethtool v2 1/2] ethtool: fix netlink bitmasks when sent as
NOMASK
On Mon, Jul 27, 2020 at 03:49:36PM -0700, Jacob Keller wrote:
> The ethtool netlink API can send bitsets without an associated bitmask.
> These do not get displayed properly, because the dump_link_modes, and
> bitset_get_bit to not check whether the provided bitset is a NOMASK
> bitset. This results in the inability to display peer advertised link
> modes.
>
> Both the dump_link_modes and bitset_git_bit functions do not check
> ETHTOOL_A_BITSET_NOMASK, and thus do not properly handle bitsets which
> do not have a provided mask.
>
> For compact bitmaps, things work more or less ok, as long as mask was
> provided as "false". This is because it will always use the
> ETHTOOL_A_BITSET_BIT_VALUE section when mask is false. A NOMASK compact
> bitmap will provide this.
>
> Unfortunately, if the bitset is not sent in the compact format, these
> functions do not behave correctly. When NOMASK is set, then the
> ETHTOOL_A_BITSET_BIT_VALUE is not provided. Instead, the application is
> supposed to treat it as a list of all the valid values.
>
> Fix these functions so that they behave properly with NOMASK bitsets in
> the non-compact form. Additionally, make these functions report an error
> if requesting to operate with "mask" set on a NOMASK bitmap. This
> ensures that we catch issues in the case where ethtool is trying to
> print the mask of a bitset that has no mask. Doing so highlights a small
> bug in the FEC settings where we accidentally set mask to true. Fix this
> also.
>
> Reported-by: Jamie Gloudon <jamie.gloudon@....fr>
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
Applied with
Fixes: 490503bdbd67 ("netlink: add bitset helpers")
Fixes: 10cc3ea337d1 ("netlink: partial netlink handler for gset (no option)")
Michal
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists