[libvirt] [PATCH 03/11] Fix passing of address family to virSocketParseAddr
Eric Blake
eblake at redhat.com
Thu Oct 21 19:51:55 UTC 2010
On 10/21/2010 12:17 PM, Daniel P. Berrange wrote:
> The virSocketParseAddr function was accepting any AF_* constant
> and using that to set the ai_flags field in struct addrinfo.
> This is invalid, since address familys must go in the ai_family
s/familys/families/
> field of the struct.
>
> * src/util/network.c: Fix handling of address family
> * src/conf/network_conf.c, src/network/bridge_driver.c: Pass
> AF_UNSPEC instead of relying on it being 0.
> +virSocketParseAddr(const char *val, virSocketAddrPtr addr, int family) {
> int len;
> struct addrinfo hints;
> struct addrinfo *res = NULL;
> @@ -75,7 +75,8 @@ virSocketParseAddr(const char *val, virSocketAddrPtr addr, int hint) {
> return(-1);
>
> memset(&hints, 0, sizeof(hints));
> - hints.ai_flags = AI_NUMERICHOST | hint;
> + hints.ai_family = family;
> + hints.ai_flags = AI_NUMERICHOST;
ACK.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list