Check existing path in mobike probing only if we still have a route
authorMartin Willi <martin@strongswan.org>
Tue, 24 Nov 2009 13:09:09 +0000 (14:09 +0100)
committerMartin Willi <martin@strongswan.org>
Thu, 26 Nov 2009 09:30:59 +0000 (10:30 +0100)
src/charon/sa/task_manager.c
src/charon/sa/tasks/ike_mobike.c

index 3fac125..f02c58c 100644 (file)
@@ -233,6 +233,7 @@ static status_t retransmit(private_task_manager_t *this, u_int32_t message_id)
                                         this->initiating.retransmitted, message_id);
                        }
                        packet = this->initiating.packet->clone(this->initiating.packet);
+                       charon->sender->send(charon->sender, packet);
                }
                else
                {       /* for routeability checks, we use a more aggressive behavior */
@@ -253,12 +254,9 @@ static status_t retransmit(private_task_manager_t *this, u_int32_t message_id)
                                DBG1(DBG_IKE, "path probing attempt %d",
                                         this->initiating.retransmitted);
                        }
-                       packet = this->initiating.packet->clone(this->initiating.packet);
-                       mobike->transmit(mobike, packet);
+                       mobike->transmit(mobike, this->initiating.packet);
                }
 
-               charon->sender->send(charon->sender, packet);
-
                this->initiating.retransmitted++;
                job = (job_t*)retransmit_job_create(this->initiating.mid,
                                                                                        this->ike_sa->get_id(this->ike_sa));
index f93d48f..d76ba8d 100644 (file)
@@ -291,7 +291,10 @@ static void transmit(private_ike_mobike_t *this, packet_t *packet)
        {
                me->set_port(me, me->ip_equals(me, me_old) ?
                                         me_old->get_port(me_old) : IKEV2_NATT_PORT);
-               packet->set_source(packet, me);
+               DBG1(DBG_IKE, "checking original path %#H - %#H", me, other_old);
+               copy = packet->clone(packet);
+               copy->set_source(copy, me);
+               charon->sender->send(charon->sender, copy);
        }
 
        iterator = this->ike_sa->create_additional_address_iterator(this->ike_sa);
@@ -320,9 +323,6 @@ static void transmit(private_ike_mobike_t *this, packet_t *packet)
                }
        }
        iterator->destroy(iterator);
-       me = packet->get_source(packet);
-       other = packet->get_destination(packet);
-       DBG1(DBG_IKE, "checking path %#H - %#H", me, other);
 }
 
 /**