Added a quick_delete task flag to enforce delete, even if CHILD_SA not found

This commit is contained in:
Martin Willi
2012-03-20 17:31:24 +01:00
parent 429d95fef2
commit 53816600ff
4 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -1354,7 +1354,7 @@ METHOD(ike_sa_t, delete_child_sa, status_t,
if (this->version == IKEV1) 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 else
{ {
+1 -1
View File
@@ -105,7 +105,7 @@ METHOD(task_t, process_r, status_t,
else else
{ {
this->del = (task_t*)quick_delete_create(this->ike_sa, this->del = (task_t*)quick_delete_create(this->ike_sa,
PROTO_NONE, 0); PROTO_NONE, 0, FALSE);
} }
} }
break; break;
+8 -2
View File
@@ -49,6 +49,11 @@ struct private_quick_delete_t {
* Inbound SPI of CHILD_SA to delete * Inbound SPI of CHILD_SA to delete
*/ */
u_int32_t spi; 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, METHOD(task_t, build_i, status_t,
private_quick_delete_t *this, message_t *message) 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; delete_payload_t *delete_payload;
@@ -185,7 +190,7 @@ METHOD(task_t, destroy, void,
* Described in header. * Described in header.
*/ */
quick_delete_t *quick_delete_create(ike_sa_t *ike_sa, protocol_id_t protocol, 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; 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, .ike_sa = ike_sa,
.protocol = protocol, .protocol = protocol,
.spi = spi, .spi = spi,
.force = force,
); );
if (protocol != PROTO_NONE) if (protocol != PROTO_NONE)
+2 -1
View File
@@ -45,9 +45,10 @@ struct quick_delete_t {
* @param ike_sa IKE_SA this task works for * @param ike_sa IKE_SA this task works for
* @param protocol protocol of CHILD_SA to delete, PROTO_NONE as responder * @param protocol protocol of CHILD_SA to delete, PROTO_NONE as responder
* @param spi inbound SPI of CHILD_SA to delete * @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 * @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, 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_ @}*/ #endif /** QUICK_DELETE_H_ @}*/