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

Re: [libvirt] [PATCH 03/11] Fix passing of address family to virSocketParseAddr



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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