Use the IKEv1 specific delete in IKEv1 SAs
authorMartin Willi <martin@revosec.ch>
Wed, 14 Dec 2011 14:27:12 +0000 (15:27 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:22 +0000 (17:31 +0100)
src/libcharon/sa/ike_sa.c
src/libcharon/sa/task_manager_v1.c
src/libcharon/sa/tasks/informational.c

index 11e7b18..fa07f58 100644 (file)
@@ -50,6 +50,7 @@
 #include <sa/tasks/quick_mode.h>
 #include <sa/tasks/ike_natd_v1.h>
 #include <sa/tasks/ike_vendor_v1.h>
+#include <sa/tasks/isakmp_delete.h>
 #include <processing/jobs/retransmit_job.h>
 #include <processing/jobs/delete_ike_sa_job.h>
 #include <processing/jobs/send_dpd_job.h>
@@ -1373,14 +1374,21 @@ METHOD(ike_sa_t, destroy_child_sa, status_t,
 METHOD(ike_sa_t, delete_, status_t,
        private_ike_sa_t *this)
 {
-       ike_delete_t *ike_delete;
+       task_t *task;
 
        switch (this->state)
        {
                case IKE_ESTABLISHED:
                case IKE_REKEYING:
-                       ike_delete = ike_delete_create(&this->public, TRUE);
-                       this->task_manager->queue_task(this->task_manager, &ike_delete->task);
+                       if (this->version == IKEV1)
+                       {
+                               task = (task_t*)isakmp_delete_create(&this->public, TRUE);
+                       }
+                       else
+                       {
+                               task = (task_t*)ike_delete_create(&this->public, TRUE);
+                       }
+                       this->task_manager->queue_task(this->task_manager, task);
                        return this->task_manager->initiate(this->task_manager);
                case IKE_CREATED:
                        DBG1(DBG_IKE, "deleting unestablished IKE_SA");
index baf7bb4..bdb55a0 100755 (executable)
@@ -334,7 +334,7 @@ METHOD(task_manager_t, initiate, status_t,
                                        exchange = INFORMATIONAL_V1;
                                        new_mid = TRUE;
                                }
-                               if (activate_task(this, TASK_IKE_DELETE))
+                               if (activate_task(this, TASK_ISAKMP_DELETE))
                                {
                                        exchange = INFORMATIONAL_V1;
                                        new_mid = TRUE;
index c2c6aa5..5391dd3 100644 (file)
@@ -16,7 +16,7 @@
 #include "informational.h"
 
 #include <daemon.h>
-#include <sa/tasks/ike_delete.h>
+#include <sa/tasks/isakmp_delete.h>
 #include <sa/tasks/child_delete.h>
 #include <encoding/payloads/delete_payload.h>
 
@@ -99,8 +99,8 @@ METHOD(task_t, process_r, status_t,
                                        delete = (delete_payload_t*)payload;
                                        if (delete->get_protocol_id(delete) == PROTO_IKE)
                                        {
-                                               this->del = (task_t*)ike_delete_create(this->ike_sa,
-                                                                                                                          FALSE);
+                                               this->del = (task_t*)isakmp_delete_create(this->ike_sa,
+                                                                                                                                 FALSE);
                                        }
                                        else
                                        {