Re: [PATCHv2] Coverity fix: properly check for 0 ipv6 address.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 01/16/2015 10:22 AM, Laine Stump wrote:
> On 01/16/2015 09:51 AM, Cédric Bosdonnat wrote:
>> ---
>>  src/util/virsocketaddr.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
>> index 91bcadf..67ed330 100644
>> --- a/src/util/virsocketaddr.c
>> +++ b/src/util/virsocketaddr.c
>> @@ -850,7 +850,7 @@ virSocketAddrGetIpPrefix(const virSocketAddr *address,
>>          }
>>          return -1;
>>      } else if (VIR_SOCKET_ADDR_IS_FAMILY(address, AF_INET6)) {
>> -        if (address->data.inet6.sin6_addr.s6_addr == 0)
>> +        if (virSocketAddrIsWildcard(address))
>>              return 0;
>>          return 64;
>>      }
> 
> According to sockettest.c, that function does work for "::", and
> examining the macro that it uses (from /usr/include/netinet/in.h) I see
> that it is doing exactly what we need (checks all 4 uint32s in the
> address against 0). So ACK.
> 
> (Nice! We should have been using that all along, instead of parsing out
> "::" and calling virSocketAddrEqual())
> 

Strange not all patches have hit my inbox, but I see they're on the list
and I got this response probably because Laine CC'd me directly.

In any case, I ran this change through Coverity and it resolves the
issue noted, so ACK from me too.

John

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]