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] [day] [month] [year] [list]
Message-ID: <20220107085127.0c0172eb@hermes.local>
Date:   Fri, 7 Jan 2022 08:51:27 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Anton Danilov <littlesmilingcloud@...il.com>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH iproute2] ip: Extend filter links/addresses

On Fri,  7 Jan 2022 17:17:38 +0300
Anton Danilov <littlesmilingcloud@...il.com> wrote:

> +	if (filter.exclude_kind && match_link_kind(tb, filter.exclude_kind, 0) == -1 &&
> +	    !strcmp(filter.exclude_kind, "ether") && ifi->ifi_type == ARPHRD_ETHER)
> +		return -1;
> +	if (filter.exclude_kind && match_link_kind(tb, filter.exclude_kind, 0) == -1 &&
> +	    !strcmp(filter.exclude_kind, "loopback") && ifi->ifi_type == ARPHRD_LOOPBACK)
> +		return -1;
> +	if (filter.exclude_kind && match_link_kind(tb, filter.exclude_kind, 0) == -1 &&
> +	    !strcmp(filter.exclude_kind, "ppp") && ifi->ifi_type == ARPHRD_PPP)
> +		return -1;
> +	if (filter.exclude_kind && !match_link_kind(tb, filter.exclude_kind, 0))
> +		return -1;
> +
> +	if (filter.kind && match_link_kind(tb, filter.kind, 0) == -1 &&
> +	    !strcmp(filter.kind, "ether") && ifi->ifi_type == ARPHRD_ETHER)
> +		;
> +	else if (filter.kind && match_link_kind(tb, filter.kind, 0) == -1 &&
> +		 !strcmp(filter.kind, "loopback") && ifi->ifi_type == ARPHRD_LOOPBACK)
> +		;
> +	else if (filter.kind && match_link_kind(tb, filter.kind, 0) == -1 &&
> +		 !strcmp(filter.kind, "ppp") && ifi->ifi_type == ARPHRD_PPP)
> +		;
> +	else if (filter.kind && match_link_kind(tb, filter.kind, 0))
>  		return -1;

This is complex enough it is getting messy, it should be helper functions.
Also the code has duplications which indicates it should be split as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ