summaryrefslogtreecommitdiff
path: root/src/libstrongswan/networking/host_resolver.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-08-25 15:37:26 +0200
commit6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch)
tree009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/libstrongswan/networking/host_resolver.c
parentc83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff)
downloadvyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.tar.gz
vyos-strongswan-6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349.zip
Imported Upstream version 5.1.0
Diffstat (limited to 'src/libstrongswan/networking/host_resolver.c')
-rw-r--r--src/libstrongswan/networking/host_resolver.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/libstrongswan/networking/host_resolver.c b/src/libstrongswan/networking/host_resolver.c
index 5e244f114..99a17d17c 100644
--- a/src/libstrongswan/networking/host_resolver.c
+++ b/src/libstrongswan/networking/host_resolver.c
@@ -233,10 +233,24 @@ METHOD(host_resolver_t, resolve, host_t*,
.family = family,
};
host_t *result;
+ struct in_addr addr;
- if (family == AF_INET && strchr(name, ':'))
- { /* do not try to convert v6 addresses for v4 family */
- return NULL;
+ switch (family)
+ {
+ 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)