Re: [libvirt] [PATCH] addrToString: give better error message

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

 



On 04/20/2010 10:13 AM, Eric Blake wrote:
> The user probably doesn't care what the gai error numbers are, as
> much as what the failed conversion IP address was.
> 
> +        char ip[INET6_ADDRSTRLEN];
> +
> +        if (inet_ntop(sa->sa_family, sa->sa_data, ip, sizeof ip)) {

This is wrong.  Given typical layout, sa->sa_data is not the same
address as ((sockaddr_in*)sa)->sin_addr or
((sockaddr_in6*)sa)->in6_addr, and since those are at different offsets,
the code needs to be conditional on the value of sa->sa_family.  I'll
post a respin soon.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]