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: <c24b1b91-12f0-86ef-4468-d499a43a73bb@gmail.com>
Date:   Tue, 23 Jan 2018 19:47:55 +0200
From:   Serhey Popovych <serhe.popovych@...il.com>
To:     David Ahern <dsahern@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next 2/8] ipaddress: Use get_addr_rta()

David Ahern wrote:
> On 1/22/18 10:26 AM, Serhey Popovych wrote:
>> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
>> index ba60125..38d994e 100644
>> --- a/ip/ipaddress.c
>> +++ b/ip/ipaddress.c
>> @@ -1523,19 +1523,20 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
>>  		if (fnmatch(filter.label, label, 0) != 0)
>>  			return 0;
>>  	}
>> -	if (filter.pfx.family) {
>> -		if (rta_tb[IFA_LOCAL]) {
>> -			inet_prefix dst = { .family = ifa->ifa_family };
>> -
>> -			memcpy(&dst.data, RTA_DATA(rta_tb[IFA_LOCAL]), RTA_PAYLOAD(rta_tb[IFA_LOCAL]));
>> -			if (inet_addr_match(&dst, &filter.pfx, filter.pfx.bitlen))
>> -				return 0;
>> -		}
>> -	}
>>  
>>  	if (filter.family && filter.family != ifa->ifa_family)
>>  		return 0;
>>  
>> +	if (filter.pfx.family && rta_tb[IFA_LOCAL]) {
>> +		struct rtattr *rta = rta_tb[IFA_LOCAL];
>> +		inet_prefix dst, *f_pfx = &filter.pfx;
>> +
>> +		if (get_addr_rta(&dst, rta, f_pfx->family))
>> +			return 0;
>> +		if (inet_addr_match(&dst, f_pfx, f_pfx->bitlen))
>> +			return 0;
>> +	}
>> +
> 
> 
> Those 2 checks are a consistent them throughout the patches. Given that
> why not create a helper that takes an rta and an inet_prefix and returns
>  the result of both checks?

Good point, will address this in v2. Thanks.

> 




Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ