]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ikev2: Ensure ALERT_RETRANSMIT_SEND_CLEARED is triggered
authorTobias Brunner <tobias@strongswan.org>
Fri, 29 May 2020 12:58:36 +0000 (14:58 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 11 Jun 2020 11:33:32 +0000 (13:33 +0200)
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.

src/libcharon/sa/ikev2/task_manager_v2.c

index 3f0e982a5e72a66d27d51bef900f9d91bfd939ad..781d6b22b7663994935ab2580f63090a661d1ad4 100644 (file)
@@ -103,6 +103,12 @@ struct private_task_manager_t {
                 */
                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
                 */
@@ -394,6 +400,7 @@ METHOD(task_manager_t, retransmit, status_t,
                                         this->initiating.retransmitted, message_id);
                                charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND, packet,
                                                                   this->initiating.retransmitted);
+                               this->initiating.retransmit_sent = TRUE;
                        }
                        if (!mobike)
                        {
@@ -635,6 +642,7 @@ METHOD(task_manager_t, initiate, status_t,
        message->set_exchange_type(message, exchange);
        this->initiating.type = exchange;
        this->initiating.retransmitted = 0;
+       this->initiating.retransmit_sent = FALSE;
        this->initiating.deferred = FALSE;
 
        enumerator = array_create_enumerator(this->active_tasks);
@@ -755,7 +763,7 @@ static status_t process_response(private_task_manager_t *this,
        }
        enumerator->destroy(enumerator);
 
-       if (this->initiating.retransmitted > 1)
+       if (this->initiating.retransmit_sent)
        {
                packet_t *packet = NULL;
                array_get(this->initiating.packets, 0, &packet);