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]
Date:   Tue, 25 Jun 2019 13:11:26 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Hangbin Liu <liuhangbin@...il.com>
Cc:     netdev@...r.kernel.org, Daniel Borkmann <daniel@...earbox.net>,
        Phil Sutter <phil@....cc>, David Ahern <dsahern@...il.com>,
        Andrea Claudi <aclaudi@...hat.com>
Subject: Re: [PATCH iproute2] ip/iptoken: fix dump error when ipv6 disabled

On Tue, 25 Jun 2019 17:35:50 +0800
Hangbin Liu <liuhangbin@...il.com> wrote:

> When we disable IPv6 from the start up (ipv6.disable=1), there will be
> no IPv6 route info in the dump message. If we return -1 when
> ifi->ifi_family != AF_INET6, we will get error like
> 
> $ ip token list
> Dump terminated
> 
> which will make user feel confused. There is no need to return -1 if the
> dump message not match. Return 0 is enough.
> 
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
>  ip/iptoken.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/ip/iptoken.c b/ip/iptoken.c
> index f1194c3e..dfd22734 100644
> --- a/ip/iptoken.c
> +++ b/ip/iptoken.c
> @@ -59,13 +59,9 @@ static int print_token(struct nlmsghdr *n, void *arg)
>  	if (len < 0)
>  		return -1;
>  
> -	if (ifi->ifi_family != AF_INET6)
> -		return -1;
> -	if (ifi->ifi_index == 0)
> -		return -1;
> -	if (ifindex > 0 && ifi->ifi_index != ifindex)
> -		return 0;
> -	if (ifi->ifi_flags & (IFF_LOOPBACK | IFF_NOARP))
> +	if (ifi->ifi_family != AF_INET6 || ifi->ifi_index == 0 ||
> +	    (ifindex > 0 && ifi->ifi_index != ifindex) ||
> +	    (ifi->ifi_flags & (IFF_LOOPBACK | IFF_NOARP)))
>  		return 0;

Please don't combine all the conditions, it is simpler as:

	if (ifi->ifi_family != AF_INET6)
		return 0;

	

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ