Moved CHILD_SA rekey task creation to protocol specific task manager
authorMartin Willi <martin@revosec.ch>
Mon, 19 Dec 2011 13:20:33 +0000 (14:20 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:27 +0000 (17:31 +0100)
src/libcharon/sa/ike_sa.c
src/libcharon/sa/ikev1/task_manager_v1.c
src/libcharon/sa/ikev2/task_manager_v2.c
src/libcharon/sa/task_manager.h

index c177a7d..7026608 100644 (file)
@@ -1265,10 +1265,7 @@ METHOD(ike_sa_t, remove_child_sa, void,
 METHOD(ike_sa_t, rekey_child_sa, status_t,
        private_ike_sa_t *this, protocol_id_t protocol, u_int32_t spi)
 {
-       child_rekey_t *child_rekey;
-
-       child_rekey = child_rekey_create(&this->public, protocol, spi);
-       this->task_manager->queue_task(this->task_manager, &child_rekey->task);
+       this->task_manager->queue_child_rekey(this->task_manager, protocol, spi);
        return this->task_manager->initiate(this->task_manager);
 }
 
index d42f63f..a4509e6 100644 (file)
@@ -1028,6 +1028,12 @@ METHOD(task_manager_t, queue_child, void,
        queue_task(this, (task_t*)quick_mode_create(this->ike_sa, cfg, tsi, tsr));
 }
 
+METHOD(task_manager_t, queue_child_rekey, void,
+       private_task_manager_t *this, protocol_id_t protocol, u_int32_t spi)
+{
+       /* TODO-IKEv1: CHILD rekeying */
+}
+
 METHOD(task_manager_t, queue_dpd, void,
        private_task_manager_t *this)
 {
@@ -1112,6 +1118,7 @@ task_manager_v1_t *task_manager_v1_create(ike_sa_t *ike_sa)
                                .queue_task = _queue_task,
                                .queue_ike = _queue_ike,
                                .queue_child = _queue_child,
+                               .queue_child_rekey = _queue_child_rekey,
                                .queue_dpd = _queue_dpd,
                                .initiate = _initiate,
                                .retransmit = _retransmit,
index cfc5454..d8dc9b8 100644 (file)
@@ -1214,6 +1214,12 @@ METHOD(task_manager_t, queue_child, void,
        queue_task(this, &task->task);
 }
 
+METHOD(task_manager_t, queue_child_rekey, void,
+       private_task_manager_t *this, protocol_id_t protocol, u_int32_t spi)
+{
+       queue_task(this, (task_t*)child_rekey_create(this->ike_sa, protocol, spi));
+}
+
 METHOD(task_manager_t, queue_dpd, void,
        private_task_manager_t *this)
 {
@@ -1340,6 +1346,7 @@ task_manager_v2_t *task_manager_v2_create(ike_sa_t *ike_sa)
                                .queue_task = _queue_task,
                                .queue_ike = _queue_ike,
                                .queue_child = _queue_child,
+                               .queue_child_rekey = _queue_child_rekey,
                                .queue_dpd = _queue_dpd,
                                .initiate = _initiate,
                                .retransmit = _retransmit,
index d4a8eeb..e2e797c 100644 (file)
@@ -141,6 +141,15 @@ struct task_manager_t {
                                                traffic_selector_t *tsi, traffic_selector_t *tsr);
 
        /**
+        * Queue CHILD_SA rekeying tasks.
+        *
+        * @param protocol              CHILD_SA protocol, AH|ESP
+        * @param spi                   CHILD_SA SPI to rekey
+        */
+       void (*queue_child_rekey)(task_manager_t *this, protocol_id_t protocol,
+                                                         u_int32_t spi);
+
+       /**
         * Queue liveness checking tasks.
         */
        void (*queue_dpd)(task_manager_t *this);