netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	Petr Machata <petrm@nvidia.com>
Subject: Re: [PATCH iproute2] dcb: fix broken "show default-prio"
Date: Fri, 25 Feb 2022 09:51:54 -0800	[thread overview]
Message-ID: <20220225095154.7232777b@hermes.local> (raw)
In-Reply-To: <20220225171258.931054-1-vladimir.oltean@nxp.com>

On Fri, 25 Feb 2022 19:12:58 +0200
Vladimir Oltean <vladimir.oltean@nxp.com> wrote:

> Although "dcb app show dev eth0 default-prio" is documented as a valid
> command in the help text, it doesn't work because the parser for the
> "show" command doesn't parse "default-prio". Fix this by establishing
> the linkage between the sub-command parsing code and
> dcb_app_print_default_prio() - which was previously only called from
> dcb_app_print().
> 
> Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  dcb/dcb_app.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
> index 6bd64bbed0cc..c135e73acb76 100644
> --- a/dcb/dcb_app.c
> +++ b/dcb/dcb_app.c
> @@ -646,6 +646,8 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
>  		if (matches(*argv, "help") == 0) {
>  			dcb_app_help_show_flush();
>  			goto out;
> +		} else if (matches(*argv, "default-prio") == 0) {
> +			dcb_app_print_default_prio(&tab);
>  		} else if (matches(*argv, "ethtype-prio") == 0) {
>  			dcb_app_print_ethtype_prio(&tab);
>  		} else if (matches(*argv, "dscp-prio") == 0) {

This is an example of why matches() sucks.
If we add this patch, then the result of command where *argv == "d"
will change.

All those argument handling should be using strcmp() instead.
Should have required that before merging dcb. David and I should
have caught that, too late now.

  reply	other threads:[~2022-02-25 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 17:12 [PATCH iproute2] dcb: fix broken "show default-prio" Vladimir Oltean
2022-02-25 17:51 ` Stephen Hemminger [this message]
2022-02-25 21:30   ` Petr Machata
2022-02-25 21:36     ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220225095154.7232777b@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).