ike: Only track actually sent retransmits as outbound packets
Retransmission jobs for old requests for which we already received a response previously left the impression that messages were sent more recently than was actually the case. task_manager_t always defined INVALID_STATE as possible return value if no retransmit was sent, this just was never actually returned. I guess we could further differentiate between actual invalid states (e.g. if we already received the response) and when we don't send a retransmit for other reasons e.g. because the IKE_SA became stale.
This commit is contained in:
@@ -2426,9 +2426,16 @@ METHOD(ike_sa_t, retransmit, status_t,
|
|||||||
{
|
{
|
||||||
return INVALID_STATE;
|
return INVALID_STATE;
|
||||||
}
|
}
|
||||||
this->stats[STAT_OUTBOUND] = time_monotonic(NULL);
|
switch (this->task_manager->retransmit(this->task_manager, message_id))
|
||||||
if (this->task_manager->retransmit(this->task_manager, message_id) != SUCCESS)
|
|
||||||
{
|
{
|
||||||
|
case SUCCESS:
|
||||||
|
this->stats[STAT_OUTBOUND] = time_monotonic(NULL);
|
||||||
|
return SUCCESS;
|
||||||
|
case INVALID_STATE:
|
||||||
|
return INVALID_STATE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* send a proper signal to brief interested bus listeners */
|
/* send a proper signal to brief interested bus listeners */
|
||||||
switch (this->state)
|
switch (this->state)
|
||||||
{
|
{
|
||||||
@@ -2499,8 +2506,6 @@ METHOD(ike_sa_t, retransmit, status_t,
|
|||||||
charon->bus->ike_updown(charon->bus, &this->public, FALSE);
|
charon->bus->ike_updown(charon->bus, &this->public, FALSE);
|
||||||
}
|
}
|
||||||
return DESTROY_ME;
|
return DESTROY_ME;
|
||||||
}
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(ike_sa_t, set_auth_lifetime, status_t,
|
METHOD(ike_sa_t, set_auth_lifetime, status_t,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2006-2019 Tobias Brunner
|
* Copyright (C) 2006-2020 Tobias Brunner
|
||||||
* Copyright (C) 2006 Daniel Roethlisberger
|
* Copyright (C) 2006 Daniel Roethlisberger
|
||||||
* Copyright (C) 2005-2009 Martin Willi
|
* Copyright (C) 2005-2009 Martin Willi
|
||||||
* Copyright (C) 2005 Jan Hutter
|
* Copyright (C) 2005 Jan Hutter
|
||||||
@@ -872,10 +872,11 @@ struct ike_sa_t {
|
|||||||
*
|
*
|
||||||
* @param message_id ID of the request to retransmit
|
* @param message_id ID of the request to retransmit
|
||||||
* @return
|
* @return
|
||||||
* - SUCCESS
|
* - SUCCESS if retransmit was sent
|
||||||
* - NOT_FOUND if request doesn't have to be retransmitted
|
* - INVALID_STATE if no retransmit required
|
||||||
|
* - DESTROY_ME if this IKE_SA MUST be deleted
|
||||||
*/
|
*/
|
||||||
status_t (*retransmit) (ike_sa_t *this, uint32_t message_id);
|
status_t (*retransmit)(ike_sa_t *this, uint32_t message_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a DPD request to the peer.
|
* Sends a DPD request to the peer.
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ static status_t retransmit_packet(private_task_manager_t *this, uint32_t seqnr,
|
|||||||
METHOD(task_manager_t, retransmit, status_t,
|
METHOD(task_manager_t, retransmit, status_t,
|
||||||
private_task_manager_t *this, uint32_t seqnr)
|
private_task_manager_t *this, uint32_t seqnr)
|
||||||
{
|
{
|
||||||
status_t status = SUCCESS;
|
status_t status = INVALID_STATE;
|
||||||
|
|
||||||
if (seqnr == this->initiating.seqnr &&
|
if (seqnr == this->initiating.seqnr &&
|
||||||
array_count(this->initiating.packets))
|
array_count(this->initiating.packets))
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ METHOD(task_manager_t, retransmit, status_t,
|
|||||||
"deferred");
|
"deferred");
|
||||||
this->ike_sa->set_condition(this->ike_sa, COND_STALE, TRUE);
|
this->ike_sa->set_condition(this->ike_sa, COND_STALE, TRUE);
|
||||||
this->initiating.deferred = TRUE;
|
this->initiating.deferred = TRUE;
|
||||||
return SUCCESS;
|
return INVALID_STATE;
|
||||||
}
|
}
|
||||||
else if (mobike->is_probing(mobike))
|
else if (mobike->is_probing(mobike))
|
||||||
{
|
{
|
||||||
@@ -443,7 +443,7 @@ METHOD(task_manager_t, retransmit, status_t,
|
|||||||
"deferred");
|
"deferred");
|
||||||
this->ike_sa->set_condition(this->ike_sa, COND_STALE, TRUE);
|
this->ike_sa->set_condition(this->ike_sa, COND_STALE, TRUE);
|
||||||
this->initiating.deferred = TRUE;
|
this->initiating.deferred = TRUE;
|
||||||
return SUCCESS;
|
return INVALID_STATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,8 +451,9 @@ METHOD(task_manager_t, retransmit, status_t,
|
|||||||
job = (job_t*)retransmit_job_create(this->initiating.mid,
|
job = (job_t*)retransmit_job_create(this->initiating.mid,
|
||||||
this->ike_sa->get_id(this->ike_sa));
|
this->ike_sa->get_id(this->ike_sa));
|
||||||
lib->scheduler->schedule_job_ms(lib->scheduler, job, timeout);
|
lib->scheduler->schedule_job_ms(lib->scheduler, job, timeout);
|
||||||
}
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
return INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(task_manager_t, initiate, status_t,
|
METHOD(task_manager_t, initiate, status_t,
|
||||||
|
|||||||
Reference in New Issue
Block a user