All of lore.kernel.org
 help / color / mirror / Atom feed
* iproute2: ip address add prefer keyword confusion
@ 2021-05-27 20:58 Norman Rasmussen
  2021-05-28  4:31 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Norman Rasmussen @ 2021-05-27 20:58 UTC (permalink / raw)
  To: netdev

commit 78d04c7b27cf ("ipaddress: Add support for address metric")
added "priority" and "preference" as aliases for the "metric" keyword,
but they are entirely undocumented.

I only noticed because I was adding addresses with a preferred
lifetime, but I was using "pref" as the keyword. The metric code was
added _above_ the lifetime code, so after the change "pref" matches
"preference", instead of "preferred_lft".

Is there an existing way to deal with conflicts between keyword
prefixes? Should "prefer" (or shorter) fail with a clear error
instead? Should the metric code have been added below the lifetime
code? Should it be moved or is it too late?

-- 
- Norman Rasmussen
 - Email: norman@rasmussen.co.za
 - Home page: http://norman.rasmussen.co.za/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iproute2: ip address add prefer keyword confusion
  2021-05-27 20:58 iproute2: ip address add prefer keyword confusion Norman Rasmussen
@ 2021-05-28  4:31 ` David Ahern
  2021-05-28 18:02   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2021-05-28  4:31 UTC (permalink / raw)
  To: Norman Rasmussen, netdev

On 5/27/21 2:58 PM, Norman Rasmussen wrote:
> commit 78d04c7b27cf ("ipaddress: Add support for address metric")
> added "priority" and "preference" as aliases for the "metric" keyword,
> but they are entirely undocumented.
> 
> I only noticed because I was adding addresses with a preferred
> lifetime, but I was using "pref" as the keyword. The metric code was
> added _above_ the lifetime code, so after the change "pref" matches
> "preference", instead of "preferred_lft".
> 
> Is there an existing way to deal with conflicts between keyword
> prefixes? Should "prefer" (or shorter) fail with a clear error
> instead? Should the metric code have been added below the lifetime
> code? Should it be moved or is it too late?
> 

It is in general a known problem with iproute2's use of "matches" to
allow shorthand commands.

The change where "pref" goes to metric vs "preferred_lft" was
unintentional. At this point (3 years after the commit) it would be hard
to revert the change.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iproute2: ip address add prefer keyword confusion
  2021-05-28  4:31 ` David Ahern
@ 2021-05-28 18:02   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2021-05-28 18:02 UTC (permalink / raw)
  To: David Ahern; +Cc: Norman Rasmussen, netdev

On Thu, 27 May 2021 22:31:24 -0600
David Ahern <dsahern@gmail.com> wrote:

> On 5/27/21 2:58 PM, Norman Rasmussen wrote:
> > commit 78d04c7b27cf ("ipaddress: Add support for address metric")
> > added "priority" and "preference" as aliases for the "metric" keyword,
> > but they are entirely undocumented.
> > 
> > I only noticed because I was adding addresses with a preferred
> > lifetime, but I was using "pref" as the keyword. The metric code was
> > added _above_ the lifetime code, so after the change "pref" matches
> > "preference", instead of "preferred_lft".
> > 
> > Is there an existing way to deal with conflicts between keyword
> > prefixes? Should "prefer" (or shorter) fail with a clear error
> > instead? Should the metric code have been added below the lifetime
> > code? Should it be moved or is it too late?
> >   
> 
> It is in general a known problem with iproute2's use of "matches" to
> allow shorthand commands.
> 
> The change where "pref" goes to metric vs "preferred_lft" was
> unintentional. At this point (3 years after the commit) it would be hard
> to revert the change.

Agreed, matches() is a real bug trap.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-28 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 20:58 iproute2: ip address add prefer keyword confusion Norman Rasmussen
2021-05-28  4:31 ` David Ahern
2021-05-28 18:02   ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.