aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/sa
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-07-28 12:09:16 +0200
committerTobias Brunner <tobias@strongswan.org>2014-09-12 10:29:36 +0200
commitc5a5bc85d9930e9e5487fa8797bf79fa682a0144 (patch)
treea028d75adbfef147fb17fcef3d8e649e75bd21e7 /src/libcharon/sa
parentff601341572b0d38b4ddde3846a145f252d1e282 (diff)
downloadstrongswan-c5a5bc85d9930e9e5487fa8797bf79fa682a0144.tar.bz2
strongswan-c5a5bc85d9930e9e5487fa8797bf79fa682a0144.tar.xz
ike-mobike: Skip peer addresses we can't send packets to when checking paths
Diffstat (limited to 'src/libcharon/sa')
-rw-r--r--src/libcharon/sa/ikev2/tasks/ike_mobike.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/libcharon/sa/ikev2/tasks/ike_mobike.c b/src/libcharon/sa/ikev2/tasks/ike_mobike.c
index dce6ecd7e..8e1efb5a1 100644
--- a/src/libcharon/sa/ikev2/tasks/ike_mobike.c
+++ b/src/libcharon/sa/ikev2/tasks/ike_mobike.c
@@ -313,12 +313,26 @@ METHOD(ike_mobike_t, transmit, void,
enumerator_t *enumerator;
ike_cfg_t *ike_cfg;
packet_t *copy;
+ int family = AF_UNSPEC;
if (!this->check)
{
return;
}
+ 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;
+ }
+
me_old = this->ike_sa->get_my_host(this->ike_sa);
other_old = this->ike_sa->get_other_host(this->ike_sa);
ike_cfg = this->ike_sa->get_ike_cfg(this->ike_sa);
@@ -326,15 +340,14 @@ METHOD(ike_mobike_t, transmit, void,
enumerator = this->ike_sa->create_peer_address_enumerator(this->ike_sa);
while (enumerator->enumerate(enumerator, (void**)&other))
{
+ if (family != AF_UNSPEC && other->get_family(other) != family)
+ {
+ continue;
+ }
me = hydra->kernel_interface->get_source_addr(
hydra->kernel_interface, other, NULL);
if (me)
{
- if (me->get_family(me) != other->get_family(other))
- {
- me->destroy(me);
- continue;
- }
/* reuse port for an active address, 4500 otherwise */
apply_port(me, me_old, ike_cfg->get_my_port(ike_cfg), TRUE);
other = other->clone(other);