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:   Wed, 1 Feb 2023 22:28:45 +0100
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Piergiorgio Beruto <piergiorgio.beruto@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org, Oleksij Rempel <o.rempel@...gutronix.de>
Subject: Re: [PATCH v4 ethtool-next 2/2] add support for IEEE 802.3cg-2019
 Clause 148 - PLCA RS

On Sat, Dec 17, 2022 at 01:50:39AM +0100, Piergiorgio Beruto wrote:
> This patch adds support for the Physical Layer Collision Avoidance
> Reconciliation Sublayer which was introduced in the IEEE 802.3
> standard by the 802.3cg working group in 2019.
> 
> The ethtool interface has been extended as follows:
> - show if the device supports PLCA when ethtool is invoked without FLAGS
>    - additionally show what PLCA version is supported
>    - show the current PLCA status
> - add FLAGS for getting and setting the PLCA configuration
> 
> Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@...il.com>
> ---
>  Makefile.am        |   1 +
>  ethtool.c          |  21 ++++
>  netlink/extapi.h   |   6 +
>  netlink/plca.c     | 295 +++++++++++++++++++++++++++++++++++++++++++++
>  netlink/settings.c |  86 ++++++++++++-

Please update also the manual page (ethtool.8.in), this should be done
whenever adding a new feature so that documented and implemented
features don't diverge.

[...]
> diff --git a/netlink/extapi.h b/netlink/extapi.h
> index 1bb580a889a8..0add156e644a 100644
> --- a/netlink/extapi.h
> +++ b/netlink/extapi.h
[...]
> @@ -114,6 +117,9 @@ nl_get_eeprom_page(struct cmd_context *ctx __maybe_unused,
>  #define nl_getmodule		NULL
>  #define nl_gmodule		NULL
>  #define nl_smodule		NULL
> +#define nl_get_plca_cfg		NULL
> +#define nl_set_plca_cfg		NULL
> +#define nl_get_plca_status	NULL
>  
>  #endif /* ETHTOOL_ENABLE_NETLINK */
>  

The function names are misspelled here so that a build with
--disable-netlink fails.

[...]
> diff --git a/netlink/plca.c b/netlink/plca.c
> new file mode 100644
> index 000000000000..f7d7bdbc5c84
> --- /dev/null
> +++ b/netlink/plca.c
> @@ -0,0 +1,295 @@
> +/*
> + * plca.c - netlink implementation of plca command
> + *
> + * Implementation of "ethtool --show-plca <dev>" and
> + * "ethtool --set-plca <dev> ..."
> + */
> +
> +#include <errno.h>
> +#include <string.h>
> +#include <stdio.h>
> +
> +#include "../internal.h"
> +#include "../common.h"
> +#include "netlink.h"
> +#include "bitset.h"
> +#include "parser.h"
> +
> +/* PLCA_GET_CFG */
[...]
> +int plca_get_cfg_reply_cb(const struct nlmsghdr *nlhdr, void *data)
> +{
> +	const struct nlattr *tb[ETHTOOL_A_PLCA_MAX + 1] = {};
> +	DECLARE_ATTR_TB_INFO(tb);
> +	struct nl_context *nlctx = data;
> +	bool silent;
> +	int idv, val;
> +	int err_ret;
> +	int ret;
[...]
> +		// The node count is ignored by follower nodes. However, it can
> +		// be pre-set to enable fast coordinator role switchover.
> +		// Therefore, on a follower node we still wanto to show it,
> +		// indicating it is not currently used.
> +		if (tb[ETHTOOL_A_PLCA_NODE_ID] && idv != 0)
> +			printf(" (ignored)");

The compiler warns that idv may be uninitialized here. While it's in
wrong, AFAICS, not even gcc13 is smart enough to recognize that it's not
actually possible so let's initialize the variable to make it happy.
Also, both idv and val are used to store unsigned values so they should
be unsigned int.

Other than these, the patch looks good to me. The next branch already
has the UAPI updates needed for it so patch 1 won't be needed any more
if you rebase on top of current next.

Michal

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ