task-manager-v1: Clear retransmit alert on request retransmit
authorThomas Egerer <thomas.egerer@secunet.com>
Tue, 2 Oct 2018 13:02:59 +0000 (15:02 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 17 Oct 2018 09:55:16 +0000 (11:55 +0200)
The task manager for IKEv1 issues a retransmit send alert in the
retransmit_packet() function. The corresponding retransmit cleared alert
however is only issued for exchanges we initiated after processing the
response in process_response().

For quick mode exchanges we may retransmit the second packet if the peer
(the initiator) does not send the third message in a timely manner. In
this case the retransmit send alert may never be cleared.

With this patch the retransmit cleared alert is issued for packets that
were retransmitted also when we are the responding party when we receive
the outstanding response.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
src/libcharon/sa/ikev1/task_manager_v1.c

index 5f6c3bb..7a1e16b 100644 (file)
@@ -1121,7 +1121,15 @@ static status_t process_request(private_task_manager_t *this,
                }
        }
        else
-       {       /* We don't send a response, so don't retransmit one if we get
+       {
+               if (this->responding.retransmitted > 1)
+               {
+                       packet_t *packet = NULL;
+                       array_get(this->responding.packets, 0, &packet);
+                       charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND_CLEARED,
+                                                          packet);
+               }
+               /* We don't send a response, so don't retransmit one if we get
                 * the same message again. */
                clear_packets(this->responding.packets);
        }