netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org, martin.varghese@nokia.com
Subject: Re: [PATCH v2 iproute2-next 1/2] m_vlan: add pop_eth and push_eth actions
Date: Thu, 22 Oct 2020 10:36:55 +0200	[thread overview]
Message-ID: <20201022083655.GA1728@pc-2.home> (raw)
In-Reply-To: <20201021113234.56052cb2@hermes.local>

On Wed, Oct 21, 2020 at 11:32:34AM -0700, Stephen Hemminger wrote:
> On Mon, 19 Oct 2020 17:23:01 +0200
> Guillaume Nault <gnault@redhat.com> wrote:
> 
> > +		} else if (matches(*argv, "pop_eth") == 0) {
> 
> Using matches allows for shorter command lines but can be make
> for bad user experience if strings overlap.
> 
> For example 'p' here will match the pop_eth and not the push_eth.

Well, the action names are tested in the following order:
  * pop (old action)
  * push (old action)
  * pop_eth (new action)
  * push_eth (new action)

Therefore, 'p' matches 'pop', thus retaining the original behaviour.

I realise that for m_mpls.c, I put the 'mac_push' action before
'modify', and thus changed the behaviour of 'm'. I'll send a patch to
move the 'mac_push' test.

> Is it time to use full string compare for these options?

If there's consensus that matches() should be avoided for new options,
I'll also follow up on this and replace it with strcmp(). However, that
should be a clear project-wide policy IMHO.


  parent reply	other threads:[~2020-10-22  8:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 15:22 [PATCH v2 iproute2-next 0/2] tc: support for new MPLS L2 VPN actions Guillaume Nault
2020-10-19 15:23 ` [PATCH v2 iproute2-next 1/2] m_vlan: add pop_eth and push_eth actions Guillaume Nault
2020-10-21 18:32   ` Stephen Hemminger
2020-10-21 18:42     ` David Ahern
2020-10-22  8:36     ` Guillaume Nault [this message]
2020-10-22 14:11       ` David Ahern
2020-10-22 14:21         ` Guillaume Nault
2020-10-19 15:23 ` [PATCH v2 iproute2-next 2/2] m_mpls: add mac_push action Guillaume Nault
2020-10-20 14:59 ` [PATCH v2 iproute2-next 0/2] tc: support for new MPLS L2 VPN actions David Ahern

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=20201022083655.GA1728@pc-2.home \
    --to=gnault@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=martin.varghese@nokia.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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).