aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-07-03 17:39:58 +0200
committerTobias Brunner <tobias@strongswan.org>2013-07-05 09:48:26 +0200
commitbf92887af19feefa08d1244a42bf9f1b0ddfb5d8 (patch)
tree1340fd0cc576c92dcaa4c0d7aeb3ba41f15bb36f
parenteafd7ee7e1164cd21fa7f9a2d828a0bb5f51ef0b (diff)
downloadstrongswan-bf92887af19feefa08d1244a42bf9f1b0ddfb5d8.tar.bz2
strongswan-bf92887af19feefa08d1244a42bf9f1b0ddfb5d8.tar.xz
ike: Resolve hosts only for address families currently supported
-rw-r--r--src/libcharon/sa/ike_sa.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c
index 87552e9c3..19c6248ec 100644
--- a/src/libcharon/sa/ike_sa.c
+++ b/src/libcharon/sa/ike_sa.c
@@ -1081,6 +1081,20 @@ METHOD(ike_sa_t, initiate_mediated, status_t,
static void resolve_hosts(private_ike_sa_t *this)
{
host_t *host;
+ int family = 0;
+
+ switch (charon->socket->supported_families(charon->socket))
+ {
+ case SOCKET_FAMILY_IPV4:
+ family = AF_INET;
+ break;
+ case SOCKET_FAMILY_IPV6:
+ family = AF_INET6;
+ break;
+ case SOCKET_FAMILY_BOTH:
+ case SOCKET_FAMILY_NONE:
+ break;
+ }
if (this->remote_host)
{
@@ -1094,7 +1108,7 @@ static void resolve_hosts(private_ike_sa_t *this)
other_addr = this->ike_cfg->get_other_addr(this->ike_cfg, NULL);
other_port = this->ike_cfg->get_other_port(this->ike_cfg);
- host = host_create_from_dns(other_addr, 0, other_port);
+ host = host_create_from_dns(other_addr, family, other_port);
}
if (host)
{
@@ -1110,7 +1124,6 @@ static void resolve_hosts(private_ike_sa_t *this)
{
char *my_addr;
u_int16_t my_port;
- int family = 0;
/* use same address family as for other */
if (!this->other_host->is_anyaddr(this->other_host))
@@ -1133,7 +1146,7 @@ static void resolve_hosts(private_ike_sa_t *this)
}
else
{ /* fallback to address family specific %any(6), if configured */
- host = host_create_from_dns(my_addr, 0, my_port);
+ host = host_create_from_dns(my_addr, family, my_port);
}
}
}