ikev2: Ensure ALERT_RETRANSMIT_SEND_CLEARED is triggered

If a MOBIKE task is deferred, the retransmission counter is reset to 0
when reinitiating.  So if there were retransmits before, this alert would
not be triggered if a response is received now without retransmits.
This commit is contained in:
Tobias Brunner
2020-06-11 13:33:32 +02:00
parent 4b225bf866
commit bc40509057
+9 -1
View File
@@ -103,6 +103,12 @@ struct private_task_manager_t {
*/ */
u_int retransmitted; u_int retransmitted;
/**
* TRUE if any retransmits have been sent for this message (counter is
* reset if deferred)
*/
bool retransmit_sent;
/** /**
* packet(s) for retransmission * packet(s) for retransmission
*/ */
@@ -394,6 +400,7 @@ METHOD(task_manager_t, retransmit, status_t,
this->initiating.retransmitted, message_id); this->initiating.retransmitted, message_id);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND, packet, charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND, packet,
this->initiating.retransmitted); this->initiating.retransmitted);
this->initiating.retransmit_sent = TRUE;
} }
if (!mobike) if (!mobike)
{ {
@@ -635,6 +642,7 @@ METHOD(task_manager_t, initiate, status_t,
message->set_exchange_type(message, exchange); message->set_exchange_type(message, exchange);
this->initiating.type = exchange; this->initiating.type = exchange;
this->initiating.retransmitted = 0; this->initiating.retransmitted = 0;
this->initiating.retransmit_sent = FALSE;
this->initiating.deferred = FALSE; this->initiating.deferred = FALSE;
enumerator = array_create_enumerator(this->active_tasks); enumerator = array_create_enumerator(this->active_tasks);
@@ -755,7 +763,7 @@ static status_t process_response(private_task_manager_t *this,
} }
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
if (this->initiating.retransmitted > 1) if (this->initiating.retransmit_sent)
{ {
packet_t *packet = NULL; packet_t *packet = NULL;
array_get(this->initiating.packets, 0, &packet); array_get(this->initiating.packets, 0, &packet);