ikev1: Reestablish IKE_SA/CHILD_SAs if it gets deleted by the peer
authorTobias Brunner <tobias@strongswan.org>
Thu, 4 Jul 2013 17:14:44 +0000 (19:14 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 17 Jul 2013 16:16:59 +0000 (18:16 +0200)
We call ike_sa_t.reestablish() so the IKE_SA is only recreated if any
CHILD_SA requires it.

src/libcharon/sa/ikev1/tasks/isakmp_delete.c

index 0640d13..a44f3c4 100644 (file)
@@ -85,6 +85,11 @@ METHOD(task_t, process_r, status_t,
                 this->ike_sa->get_other_host(this->ike_sa),
                 this->ike_sa->get_other_id(this->ike_sa));
 
+       if (this->ike_sa->get_state(this->ike_sa) == IKE_ESTABLISHED)
+       {
+               this->ike_sa->set_state(this->ike_sa, IKE_DELETING);
+               this->ike_sa->reestablish(this->ike_sa);
+       }
        this->ike_sa->set_state(this->ike_sa, IKE_DELETING);
        charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
        return DESTROY_ME;