diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c index 223901cad..cb560cd85 100644 --- a/src/libcharon/sa/ike_sa.c +++ b/src/libcharon/sa/ike_sa.c @@ -1354,7 +1354,7 @@ METHOD(ike_sa_t, delete_child_sa, status_t, if (this->version == IKEV1) { - task = (task_t*)quick_delete_create(&this->public, protocol, spi); + task = (task_t*)quick_delete_create(&this->public, protocol, spi, FALSE); } else { diff --git a/src/libcharon/sa/tasks/informational.c b/src/libcharon/sa/tasks/informational.c index f0ddad021..60e1cfcb8 100644 --- a/src/libcharon/sa/tasks/informational.c +++ b/src/libcharon/sa/tasks/informational.c @@ -105,7 +105,7 @@ METHOD(task_t, process_r, status_t, else { this->del = (task_t*)quick_delete_create(this->ike_sa, - PROTO_NONE, 0); + PROTO_NONE, 0, FALSE); } } break; diff --git a/src/libcharon/sa/tasks/quick_delete.c b/src/libcharon/sa/tasks/quick_delete.c index 61fa2ef1f..a5f27c5e0 100644 --- a/src/libcharon/sa/tasks/quick_delete.c +++ b/src/libcharon/sa/tasks/quick_delete.c @@ -49,6 +49,11 @@ struct private_quick_delete_t { * Inbound SPI of CHILD_SA to delete */ u_int32_t spi; + + /** + * Send delete even if SA does not exist + */ + bool force; }; /** @@ -96,7 +101,7 @@ static bool delete_child(private_quick_delete_t *this, METHOD(task_t, build_i, status_t, private_quick_delete_t *this, message_t *message) { - if (delete_child(this, this->protocol, this->spi)) + if (delete_child(this, this->protocol, this->spi) || this->force) { delete_payload_t *delete_payload; @@ -185,7 +190,7 @@ METHOD(task_t, destroy, void, * Described in header. */ quick_delete_t *quick_delete_create(ike_sa_t *ike_sa, protocol_id_t protocol, - u_int32_t spi) + u_int32_t spi, bool force) { private_quick_delete_t *this; @@ -200,6 +205,7 @@ quick_delete_t *quick_delete_create(ike_sa_t *ike_sa, protocol_id_t protocol, .ike_sa = ike_sa, .protocol = protocol, .spi = spi, + .force = force, ); if (protocol != PROTO_NONE) diff --git a/src/libcharon/sa/tasks/quick_delete.h b/src/libcharon/sa/tasks/quick_delete.h index a0dbd0bc7..80aae8273 100644 --- a/src/libcharon/sa/tasks/quick_delete.h +++ b/src/libcharon/sa/tasks/quick_delete.h @@ -45,9 +45,10 @@ struct quick_delete_t { * @param ike_sa IKE_SA this task works for * @param protocol protocol of CHILD_SA to delete, PROTO_NONE as responder * @param spi inbound SPI of CHILD_SA to delete + * @param force send delete even if SA does not exist * @return quick_delete task to handle by the task_manager */ quick_delete_t *quick_delete_create(ike_sa_t *ike_sa, protocol_id_t protocol, - u_int32_t spi); + u_int32_t spi, bool force); #endif /** QUICK_DELETE_H_ @}*/