fixed resolving numerical IPv6 addresses in host_create_from_dns()
authorMartin Willi <martin@strongswan.org>
Wed, 11 Jun 2008 07:44:23 +0000 (07:44 -0000)
committerMartin Willi <martin@strongswan.org>
Wed, 11 Jun 2008 07:44:23 +0000 (07:44 -0000)
src/libstrongswan/utils/host.c

index bc31f22..bc85942 100644 (file)
@@ -461,6 +461,11 @@ host_t *host_create_from_dns(char *string, int af, u_int16_t port)
        char buf[512];
        int err, ret;
        
+       if (strchr(string, ':'))
+       {       /* gethostbyname does not like IPv6 addresses, fallback */
+               return host_create_from_string(string, port);
+       }
+       
        if (af)
        {       
                ret = gethostbyname2_r(string, af, &host, buf, sizeof(buf), &ptr, &err);