Initiate and respond to quick mode task (stub)
authorMartin Willi <martin@revosec.ch>
Mon, 21 Nov 2011 10:56:58 +0000 (11:56 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:30:45 +0000 (17:30 +0100)
src/libcharon/sa/ike_sa.c
src/libcharon/sa/task_manager_v1.c

index e7478bd..1190188 100644 (file)
@@ -45,6 +45,7 @@
 #include <sa/tasks/child_delete.h>
 #include <sa/tasks/child_rekey.h>
 #include <sa/tasks/main_mode.h>
+#include <sa/tasks/quick_mode.h>
 #include <processing/jobs/retransmit_job.h>
 #include <processing/jobs/delete_ike_sa_job.h>
 #include <processing/jobs/send_dpd_job.h>
@@ -1190,13 +1191,13 @@ METHOD(ike_sa_t, initiate, status_t,
                                child_create_t *child_create = (child_create_t*)task;
                                child_create->use_reqid(child_create, reqid);
                        }
-                       this->task_manager->queue_task(this->task_manager, task);
                }
                else
                {
-                       /* TODO-IKEv1: create quick mode task */
+                       task = (task_t*)quick_mode_create(&this->public, child_cfg,
+                                                                                         tsi, tsr);
                }
-               child_cfg->destroy(child_cfg);
+               this->task_manager->queue_task(this->task_manager, task);
 
 #ifdef ME
                if (this->peer_cfg->get_mediated_by(this->peer_cfg))
index 4197698..6cc2d75 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <daemon.h>
 #include <sa/tasks/main_mode.h>
+#include <sa/tasks/quick_mode.h>
 
 typedef struct exchange_t exchange_t;
 
@@ -214,6 +215,12 @@ METHOD(task_manager_t, initiate, status_t,
                                        exchange = ID_PROT;
                                }
                                break;
+                       case IKE_ESTABLISHED:
+                               if (activate_task(this, TASK_QUICK_MODE))
+                               {
+                                       exchange = QUICK_MODE;
+                               }
+                               break;
                        default:
                                break;
                }
@@ -230,6 +237,9 @@ METHOD(task_manager_t, initiate, status_t,
                                case MAIN_MODE:
                                        exchange = ID_PROT;
                                        break;
+                               case TASK_QUICK_MODE:
+                                       exchange = QUICK_MODE;
+                                       break;
                                default:
                                        continue;
                        }
@@ -423,8 +433,10 @@ static status_t process_request(private_task_manager_t *this,
                                /* TODO-IKEv1: agressive mode */
                                return FAILED;
                        case QUICK_MODE:
-                               /* TODO-IKEv1: quick mode */
-                               return FAILED;
+                               task = (task_t *)quick_mode_create(this->ike_sa, NULL,
+                                                                                                  NULL, NULL);
+                               this->passive_tasks->insert_last(this->passive_tasks, task);
+                               break;
                        case INFORMATIONAL_V1:
                                /* TODO-IKEv1: informational */
                                return FAILED;