Confirm message reception time only if DPD sequence number valid

This commit is contained in:
Martin Willi
2012-03-20 17:31:35 +01:00
parent 2ddd45c9a7
commit ff6b084ac4
2 changed files with 10 additions and 3 deletions
+8 -3
View File
@@ -735,7 +735,7 @@ static status_t process_request(private_task_manager_t *this,
{ {
enumerator_t *enumerator; enumerator_t *enumerator;
task_t *task = NULL; task_t *task = NULL;
bool send_response = FALSE; bool send_response = FALSE, dpd = FALSE;
notify_payload_t *notify; notify_payload_t *notify;
chunk_t data; chunk_t data;
@@ -790,11 +790,13 @@ static status_t process_request(private_task_manager_t *this,
} }
task = (task_t *)isakmp_dpd_create(this->ike_sa, FALSE, task = (task_t *)isakmp_dpd_create(this->ike_sa, FALSE,
this->dpd_recv++); this->dpd_recv++);
dpd = TRUE;
} }
else if (message->get_notify(message, DPD_R_U_THERE_ACK)) else if (message->get_notify(message, DPD_R_U_THERE_ACK))
{ {
task = (task_t *)isakmp_dpd_create(this->ike_sa, TRUE, task = (task_t *)isakmp_dpd_create(this->ike_sa, TRUE,
this->dpd_send - 1); this->dpd_send - 1);
dpd = TRUE;
} }
else else
{ {
@@ -817,6 +819,11 @@ static status_t process_request(private_task_manager_t *this,
return FAILED; return FAILED;
} }
} }
if (!dpd)
{
this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND,
time_monotonic(NULL));
}
/* let the tasks process the message */ /* let the tasks process the message */
enumerator = this->passive_tasks->create_enumerator(this->passive_tasks); enumerator = this->passive_tasks->create_enumerator(this->passive_tasks);
while (enumerator->enumerate(enumerator, (void*)&task)) while (enumerator->enumerate(enumerator, (void*)&task))
@@ -1117,8 +1124,6 @@ METHOD(task_manager_t, process_message, status_t,
lib->settings->get_int(lib->settings, lib->settings->get_int(lib->settings,
"charon.half_open_timeout", HALF_OPEN_IKE_SA_TIMEOUT)); "charon.half_open_timeout", HALF_OPEN_IKE_SA_TIMEOUT));
} }
this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND,
time_monotonic(NULL));
this->ike_sa->update_hosts(this->ike_sa, me, other, TRUE); this->ike_sa->update_hosts(this->ike_sa, me, other, TRUE);
charon->bus->message(charon->bus, msg, TRUE); charon->bus->message(charon->bus, msg, TRUE);
if (process_request(this, msg) != SUCCESS) if (process_request(this, msg) != SUCCESS)
@@ -91,6 +91,8 @@ METHOD(task_t, process, status_t,
seqnr = untoh32(chunk.ptr); seqnr = untoh32(chunk.ptr);
if (seqnr == this->seqnr) if (seqnr == this->seqnr)
{ {
this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND,
time_monotonic(NULL));
if (!this->initiator) if (!this->initiator)
{ /* queue DPD_ACK */ { /* queue DPD_ACK */
this->ike_sa->queue_task(this->ike_sa, this->ike_sa->queue_task(this->ike_sa,