lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <547F20CA.4060501@cumulusnetworks.com>
Date:	Wed, 03 Dec 2014 06:40:10 -0800
From:	Roopa Prabhu <roopa@...ulusnetworks.com>
To:	vadim4j@...il.com
CC:	netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] ip link: Show devices by link type

On 12/2/14, 5:13 PM, vadim4j@...il.com wrote:
> On Tue, Dec 02, 2014 at 04:55:44PM -0800, Roopa Prabhu wrote:
>>>   	int master;
>>> +	char *link_kind;
>> The name can be just "kind", given all the others dont use the link prefix
>>>   } filter;
> OK
>
>>> +	if (filter.link_kind && tb[IFLA_LINKINFO]) {
>>> +		char *link_kind = parse_link_kind(tb[IFLA_LINKINFO]);
>>> +		if (strcmp(link_kind, filter.link_kind)) {
>>> +			return -1;
>>> +		}
>> you can skip the braces
>>> +	} else if (filter.link_kind)
>> you have if (filter.link_kind) twice, you can use a single if without the
>> else.
>>> +		return -1;
>>> +
> I need to skip interfaces which has not IFLA_LINKINFO attribute,
> w/o "else if(...)" I get bridges with normal ether devices:
>      
>      bash# ip link show type bridge
>
>      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>      2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
>          link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
>      5: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
>          link/ether 6e:02:f9:17:7f:10 brd ff:ff:ff:ff:ff:ff
>
> but expected result should be only bridges.

I was just saying, it could be:

if (filter.link_kind) {
     if (tb[IFLA_LINKINFO]) {
         char *kind = parse_link_kind(tb[IFLA_LINKINFO]);
         if (strcmp(kind, filter.kind))
             return -1;
     } else {
       return -1;
     }
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ