s4-ipv6: fix the address family for IPv6 string addresses
authorAndrew Tridgell <tridge@samba.org>
Mon, 6 Jun 2011 00:42:28 +0000 (10:42 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 6 Jun 2011 02:26:11 +0000 (12:26 +1000)
source4/lib/socket/socket.c

index 41638b3d72f3fd7655041437f8308f06a35d0c62..369cf5ff3666986c4522054b18d811d036225f13 100644 (file)
@@ -473,6 +473,11 @@ _PUBLIC_ struct socket_address *socket_address_from_strings(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
+       if (strcmp(family, "ip") == 0 && is_ipaddress_v6(host)) {
+               /* leaving as "ip" would force IPv4 */
+               family = "ipv6";
+       }
+
        addr->family = family;
        addr->addr = talloc_strdup(addr, host);
        if (!addr->addr) {