Implemented CHILD_SA rekeying
authorMartin Willi <martin@revosec.ch>
Mon, 2 Jan 2012 13:27:10 +0000 (14:27 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:31 +0000 (17:31 +0100)
src/libcharon/sa/ikev1/task_manager_v1.c

index f388bc8..ea4cb8a 100644 (file)
@@ -1169,7 +1169,24 @@ METHOD(task_manager_t, queue_child, void,
 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 */
+       child_sa_t *child_sa;
+       child_cfg_t *cfg;
+       quick_mode_t *task;
+
+       child_sa = this->ike_sa->get_child_sa(this->ike_sa, protocol, spi, TRUE);
+       if (!child_sa)
+       {
+               child_sa = this->ike_sa->get_child_sa(this->ike_sa, protocol, spi, FALSE);
+       }
+       if (child_sa && child_sa->get_state(child_sa) == CHILD_INSTALLED)
+       {
+               child_sa->set_state(child_sa, CHILD_REKEYING);
+               cfg = child_sa->get_config(child_sa);
+               task = quick_mode_create(this->ike_sa, cfg->get_ref(cfg), NULL, NULL);
+               task->use_reqid(task, child_sa->get_reqid(child_sa));
+
+               queue_task(this, &task->task);
+       }
 }
 
 METHOD(task_manager_t, queue_child_delete, void,