
On 02/18/13 17:13, Viktor Mihajlovski wrote:
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.
I only wanted to check the first result, which is what QEMU on the source will do (until http://git.qemu.org/?p=qemu.git;h=233aa5c in 1.3.0). This would break migration if the family of the first address is different on the source and destination. I assume this is less likely than getaddrinfo with INET6 hint returning an IPv6 address, even though there is no IPv6 connectivity between them.
In both cases you will have to call freeaddrinfo in the cleanup section to avoid a memory leak.
Thanks for catching that. Jan