public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vincent Bernat <vincent@bernat•im>
To: Stephen Hemminger <stephen@networkplumber•org>
Cc: netdev@vger•kernel.org, serhe.popovych@gmail•com
Subject: Re: [PATCH iproute2-next] ipaddress: fix label matching
Date: Wed, 11 Jul 2018 22:26:53 +0200	[thread overview]
Message-ID: <m3y3eh4iya.fsf@luffy.cx> (raw)
In-Reply-To: <20180711130328.1d5bc82f@xeon-e3> (Stephen Hemminger's message of "Wed, 11 Jul 2018 13:03:28 -0700")

 ❦ 11 juillet 2018 13:03 -0700, Stephen Hemminger <stephen@networkplumber•org> :

>> Since 9516823051ce, "ip addr show label lo:1" doesn't work
>> anymore (doesn't show any address, despite a matching label).
>> Reverting to return 0 instead of -1 fix the issue.
>> 
>> However, the condition says: "if we filter by label [...] and the
>> label does NOT match the interface name". This makes little sense to
>> compare the label with the interface name. There is also a logic
>> around filter family being provided or not. The match against the
>> label is done by ifa_label_match_rta() in print_addrinfo() and
>> ipaddr_filter().
>> 
>> Just removing the condition makes "ip addr show" works as expected
>> with or without specifying a label, both when the label is matching
>> and not matching. It also works if we specify a label and the label is
>> the interface name. The flush operation also works as expected.
>> 
>> Fixes: 9516823051ce ("ipaddress: Improve print_linkinfo()")
>> Signed-off-by: Vincent Bernat <vincent@bernat•im>
>> ---
>>  ip/ipaddress.c | 5 -----
>>  1 file changed, 5 deletions(-)
>> 
>> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
>> index 5009bfe6d2e3..20ef6724944e 100644
>> --- a/ip/ipaddress.c
>> +++ b/ip/ipaddress.c
>> @@ -837,11 +837,6 @@ int print_linkinfo(const struct sockaddr_nl *who,
>>  	if (!name)
>>  		return -1;
>>  
>> -	if (filter.label &&
>> -	    (!filter.family || filter.family == AF_PACKET) &&
>> -	    fnmatch(filter.label, name, 0))
>> -		return -1;
>> -
>>  	if (tb[IFLA_GROUP]) {
>>  		int group = rta_getattr_u32(tb[IFLA_GROUP]);
>> 
>
> If this is a regression, it should go to iproute2 not iproute2-next.
>
> Surprised by the solution since it is removing code that was there
> before the commit you referenced in Fixes.

Yes, but as I explain in the commit message, the condition does not make
sense for me: why would we match the label against the interface name?
This code exists since a long time.
-- 
The lunatic, the lover, and the poet,
Are of imagination all compact...
		-- Wm. Shakespeare, "A Midsummer Night's Dream"

  reply	other threads:[~2018-07-11 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 11:36 [PATCH iproute2-next] ipaddress: fix label matching Vincent Bernat
2018-07-11 20:03 ` Stephen Hemminger
2018-07-11 20:26   ` Vincent Bernat [this message]
2018-07-12  1:01 ` David Ahern
2018-07-12  5:08   ` Vincent Bernat
2018-07-14  8:27     ` Serhey Popovych
2018-07-14 18:54       ` Serhey Popovych
2018-07-14 18:58         ` Vincent Bernat

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=m3y3eh4iya.fsf@luffy.cx \
    --to=vincent@bernat$(echo .)im \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=serhe.popovych@gmail$(echo .)com \
    --cc=stephen@networkplumber$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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