Do not query CHILD_SA during delete if they already expired
This commit is contained in:
@@ -1141,7 +1141,7 @@ METHOD(task_manager_t, queue_ike_delete, void,
|
||||
{
|
||||
queue_task(this, (task_t*)
|
||||
quick_delete_create(this->ike_sa, child_sa->get_protocol(child_sa),
|
||||
child_sa->get_spi(child_sa, TRUE), FALSE));
|
||||
child_sa->get_spi(child_sa, TRUE), FALSE, FALSE));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
@@ -1190,10 +1190,11 @@ METHOD(task_manager_t, queue_child_rekey, void,
|
||||
}
|
||||
|
||||
METHOD(task_manager_t, queue_child_delete, void,
|
||||
private_task_manager_t *this, protocol_id_t protocol, u_int32_t spi)
|
||||
private_task_manager_t *this, protocol_id_t protocol, u_int32_t spi,
|
||||
bool expired)
|
||||
{
|
||||
queue_task(this, (task_t*)quick_delete_create(this->ike_sa, protocol,
|
||||
spi, FALSE));
|
||||
spi, FALSE, expired));
|
||||
}
|
||||
|
||||
METHOD(task_manager_t, queue_dpd, void,
|
||||
|
||||
@@ -108,7 +108,7 @@ METHOD(task_t, process_r, status_t,
|
||||
else
|
||||
{
|
||||
this->del = (task_t*)quick_delete_create(this->ike_sa,
|
||||
PROTO_NONE, 0, FALSE);
|
||||
PROTO_NONE, 0, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -54,6 +54,11 @@ struct private_quick_delete_t {
|
||||
* Send delete even if SA does not exist
|
||||
*/
|
||||
bool force;
|
||||
|
||||
/**
|
||||
* SA already expired?
|
||||
*/
|
||||
bool expired;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -78,16 +83,29 @@ static bool delete_child(private_quick_delete_t *this,
|
||||
|
||||
child_sa->set_state(child_sa, CHILD_DELETING);
|
||||
|
||||
child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in);
|
||||
child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out);
|
||||
if (this->expired)
|
||||
{
|
||||
DBG0(DBG_IKE, "closing expired CHILD_SA %s{%d} "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
|
||||
ntohl(child_sa->get_spi(child_sa, TRUE)),
|
||||
ntohl(child_sa->get_spi(child_sa, FALSE)),
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
}
|
||||
else
|
||||
{
|
||||
child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in);
|
||||
child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out);
|
||||
|
||||
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} "
|
||||
"with SPIs %.8x_i (%llu bytes) %.8x_o (%llu bytes) and TS %#R=== %#R",
|
||||
child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
|
||||
ntohl(child_sa->get_spi(child_sa, TRUE)), bytes_in,
|
||||
ntohl(child_sa->get_spi(child_sa, FALSE)), bytes_out,
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} with SPIs "
|
||||
"%.8x_i (%llu bytes) %.8x_o (%llu bytes) and TS %#R=== %#R",
|
||||
child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
|
||||
ntohl(child_sa->get_spi(child_sa, TRUE)), bytes_in,
|
||||
ntohl(child_sa->get_spi(child_sa, FALSE)), bytes_out,
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
}
|
||||
|
||||
charon->bus->child_updown(charon->bus, child_sa, FALSE);
|
||||
|
||||
@@ -190,7 +208,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, bool force)
|
||||
u_int32_t spi, bool force, bool expired)
|
||||
{
|
||||
private_quick_delete_t *this;
|
||||
|
||||
@@ -206,6 +224,7 @@ quick_delete_t *quick_delete_create(ike_sa_t *ike_sa, protocol_id_t protocol,
|
||||
.protocol = protocol,
|
||||
.spi = spi,
|
||||
.force = force,
|
||||
.expired = expired,
|
||||
);
|
||||
|
||||
if (protocol != PROTO_NONE)
|
||||
|
||||
@@ -46,9 +46,10 @@ struct quick_delete_t {
|
||||
* @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
|
||||
* @param expired TRUE if SA already expired
|
||||
* @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, bool force);
|
||||
u_int32_t spi, bool force, bool expired);
|
||||
|
||||
#endif /** QUICK_DELETE_H_ @}*/
|
||||
|
||||
@@ -773,7 +773,7 @@ METHOD(task_t, process_r, status_t,
|
||||
this->ike_sa->queue_task(this->ike_sa,
|
||||
(task_t*)quick_delete_create(this->ike_sa,
|
||||
this->proposal->get_protocol(this->proposal),
|
||||
this->spi_i, TRUE));
|
||||
this->spi_i, TRUE, TRUE));
|
||||
return ALREADY_DONE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user