diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-08-25 15:37:26 +0200 |
commit | 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (patch) | |
tree | 009fc492961e13860d2a4bc2de8caf2bbe2975e7 /src/libstrongswan/networking/host_resolver.c | |
parent | c83921a2b566aa9d55d8ccc7258f04fca6292ee6 (diff) | |
download | vyos-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.c | 20 |
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) |