From: Tobias Brunner Date: Mon, 28 Jul 2014 11:51:27 +0000 (+0200) Subject: ikev2: Defer MOBIKE updates if no path is available X-Git-Tag: 5.2.1dr1~65^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de6ab8e85a5f8e37a0e055b0eeb0a3e5042b1fb2;p=thirdparty%2Fstrongswan.git ikev2: Defer MOBIKE updates if no path is available --- diff --git a/src/libcharon/sa/ikev2/task_manager_v2.c b/src/libcharon/sa/ikev2/task_manager_v2.c index 8094e34aca..c73bf01687 100644 --- a/src/libcharon/sa/ikev2/task_manager_v2.c +++ b/src/libcharon/sa/ikev2/task_manager_v2.c @@ -241,16 +241,12 @@ METHOD(task_manager_t, retransmit, status_t, if (task->get_type(task) == TASK_IKE_MOBIKE) { mobike = (ike_mobike_t*)task; - if (!mobike->is_probing(mobike)) - { - mobike = NULL; - } break; } } enumerator->destroy(enumerator); - if (mobike == NULL) + if (!mobike || !mobike->is_probing(mobike)) { if (this->initiating.retransmitted <= this->retransmit_tries) { @@ -273,8 +269,19 @@ METHOD(task_manager_t, retransmit, status_t, charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND, this->initiating.packet); } - packet = this->initiating.packet->clone(this->initiating.packet); - charon->sender->send(charon->sender, packet); + if (!mobike) + { + packet = this->initiating.packet->clone(this->initiating.packet); + charon->sender->send(charon->sender, packet); + } + else if (!mobike->transmit(mobike, this->initiating.packet)) + { + DBG1(DBG_IKE, "no route found to reach peer, MOBIKE update " + "deferred"); + this->ike_sa->set_condition(this->ike_sa, COND_STALE, TRUE); + this->initiating.deferred = TRUE; + return SUCCESS; + } } else { /* for routeability checks, we use a more aggressive behavior */