Trigger ike_updown event caused by retransmits only after reestablish() has been...
authorTobias Brunner <tobias@strongswan.org>
Wed, 5 Sep 2012 14:03:20 +0000 (16:03 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 6 Sep 2012 09:27:28 +0000 (11:27 +0200)
This allows listeners to migrate to the new IKE_SA with the
ike_reestablish event without having to worry about an ike_updown event
for the old IKE_SA.

src/libcharon/sa/ike_sa.c
src/libcharon/sa/ikev1/task_manager_v1.c
src/libcharon/sa/ikev2/task_manager_v2.c

index e141380..635528c 100644 (file)
@@ -1713,6 +1713,10 @@ METHOD(ike_sa_t, retransmit, status_t,
                                reestablish(this);
                                break;
                }
+               if (this->state != IKE_CONNECTING)
+               {
+                       charon->bus->ike_updown(charon->bus, &this->public, FALSE);
+               }
                return DESTROY_ME;
        }
        return SUCCESS;
index ea836b7..1ca8a0c 100644 (file)
@@ -293,10 +293,6 @@ static status_t retransmit_packet(private_task_manager_t *this, u_int32_t seqnr,
        if (retransmitted > this->retransmit_tries)
        {
                DBG1(DBG_IKE, "giving up after %u retransmits", retransmitted - 1);
-               if (this->ike_sa->get_state(this->ike_sa) != IKE_CONNECTING)
-               {
-                       charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
-               }
                return DESTROY_ME;
        }
        t = (u_int32_t)(this->retransmit_timeout * 1000.0 *
@@ -599,7 +595,7 @@ METHOD(task_manager_t, initiate, status_t,
        }
 
        this->initiating.seqnr++;
-       if (expect_response )
+       if (expect_response)
        {
                message->destroy(message);
                return retransmit(this, this->initiating.seqnr);
index 81367d2..83e08b3 100644 (file)
@@ -257,10 +257,6 @@ METHOD(task_manager_t, retransmit, status_t,
                        {
                                DBG1(DBG_IKE, "giving up after %d retransmits",
                                         this->initiating.retransmitted - 1);
-                               if (this->ike_sa->get_state(this->ike_sa) != IKE_CONNECTING)
-                               {
-                                       charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
-                               }
                                return DESTROY_ME;
                        }
 
@@ -282,7 +278,6 @@ METHOD(task_manager_t, retransmit, status_t,
                        {
                                DBG1(DBG_IKE, "giving up after %d path probings",
                                         this->initiating.retransmitted - 1);
-                               charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
                                return DESTROY_ME;
                        }