unit-tests: Add a simple thread_cancel() test
[strongswan.git] / src / libstrongswan / networking / host_resolver.c
index 71aa0b1..99a17d1 100644 (file)
@@ -233,18 +233,24 @@ METHOD(host_resolver_t, resolve, host_t*,
                .family = family,
        };
        host_t *result;
+       struct in_addr addr;
 
-       if (streq(name, "%any") || streq(name, "0.0.0.0"))
+       switch (family)
        {
-               return host_create_any(family ? family : AF_INET);
-       }
-       if (streq(name, "%any6") || streq(name, "::"))
-       {
-               return host_create_any(family ? family : AF_INET6);
-       }
-       if (family == AF_INET && strchr(name, ':'))
-       {       /* do not try to convert v6 addresses for v4 family */
-               return NULL;
+               case AF_INET:
+                       /* do not try to convert v6 addresses for v4 family */
+                       if (strchr(name, ':'))
+                       {
+                               return NULL;
+                       }
+                       break;
+               case AF_INET6:
+                       /* do not try to convert v4 addresses for v6 family */
+                       if (inet_pton(AF_INET, name, &addr) == 1)
+                       {
+                               return NULL;
+                       }
+                       break;
        }
        this->mutex->lock(this->mutex);
        if (this->disabled)