[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201022083655.GA1728@pc-2.home>
Date: Thu, 22 Oct 2020 10:36:55 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: David Ahern <dsahern@...il.com>, netdev@...r.kernel.org,
martin.varghese@...ia.com
Subject: Re: [PATCH v2 iproute2-next 1/2] m_vlan: add pop_eth and push_eth
actions
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@...hat.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.
Powered by blists - more mailing lists