ike-mobike: Allow calling transmit() even when not currently path probing
authorTobias Brunner <tobias@strongswan.org>
Mon, 28 Jul 2014 11:46:16 +0000 (13:46 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 12 Sep 2014 08:29:37 +0000 (10:29 +0200)
Path probing is enabled if the current path is not available anymore.

src/libcharon/sa/ikev2/tasks/ike_mobike.c

index 6567901..d91fa58 100644 (file)
@@ -316,9 +316,25 @@ METHOD(ike_mobike_t, transmit, bool,
        int family = AF_UNSPEC;
        bool found = FALSE;
 
+       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);
+
        if (!this->check)
        {
-               return TRUE;
+               me = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
+                                                                                                         other_old, me_old);
+               if (me)
+               {
+                       if (me->ip_equals(me, me_old))
+                       {
+                               charon->sender->send(charon->sender, packet->clone(packet));
+                               me->destroy(me);
+                               return TRUE;
+                       }
+                       me->destroy(me);
+               }
+               this->check = TRUE;
        }
 
        switch (charon->socket->supported_families(charon->socket))
@@ -334,10 +350,6 @@ METHOD(ike_mobike_t, transmit, bool,
                        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);
-
        enumerator = this->ike_sa->create_peer_address_enumerator(this->ike_sa);
        while (enumerator->enumerate(enumerator, (void**)&other))
        {