On 02/18/2013 04:30 PM, Ján Tomko wrote:
+ if (getaddrinfo(hostname, NULL, NULL, &info)) { + VIR_WARN("unable to get address info for %s, defaulting to IPv4", + hostname); + } else { + ipv6 = info->ai_family == AF_INET6; + } +
getaddrinfo can return a list of IPv4 and IPv6 addresses for a hostname. If you want to give preference to the IPv6 address you will need to iterate the return info list. Alternatively you can pass in a hints addrinfo with ai_family set to AF_INET6. In both cases you will have to call freeaddrinfo in the cleanup section to avoid a memory leak. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list