]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Confirm message reception time only if DPD sequence number valid
authorMartin Willi <martin@revosec.ch>
Tue, 10 Jan 2012 16:26:42 +0000 (17:26 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:35 +0000 (17:31 +0100)
src/libcharon/sa/ikev1/task_manager_v1.c
src/libcharon/sa/ikev1/tasks/isakmp_dpd.c

index ec5eee155f6e64d379daea6b86c090eb1f56bd47..562a9eb42a11b96e9b1b8181df114715597bfcc5 100755 (executable)
@@ -735,7 +735,7 @@ static status_t process_request(private_task_manager_t *this,
 {
        enumerator_t *enumerator;
        task_t *task = NULL;
-       bool send_response = FALSE;
+       bool send_response = FALSE, dpd = FALSE;
        notify_payload_t *notify;
        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,
                                                                                                           this->dpd_recv++);
+                                       dpd = TRUE;
                                }
                                else if (message->get_notify(message, DPD_R_U_THERE_ACK))
                                {
                                        task = (task_t *)isakmp_dpd_create(this->ike_sa, TRUE,
                                                                                                           this->dpd_send - 1);
+                                       dpd = TRUE;
                                }
                                else
                                {
@@ -817,6 +819,11 @@ static status_t process_request(private_task_manager_t *this,
                                return FAILED;
                }
        }
+       if (!dpd)
+       {
+               this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND,
+                                                                       time_monotonic(NULL));
+       }
        /* let the tasks process the message */
        enumerator = this->passive_tasks->create_enumerator(this->passive_tasks);
        while (enumerator->enumerate(enumerator, (void*)&task))
@@ -1117,8 +1124,6 @@ METHOD(task_manager_t, process_message, status_t,
                                        lib->settings->get_int(lib->settings,
                                                "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);
                charon->bus->message(charon->bus, msg, TRUE);
                if (process_request(this, msg) != SUCCESS)
index e2ed17dcd312d396ac46d9fbfcbf53b47a231ee9..e470e90ad9beb01d7a0628f5c49986393958de60 100755 (executable)
@@ -91,6 +91,8 @@ METHOD(task_t, process, status_t,
                        seqnr = untoh32(chunk.ptr);
                        if (seqnr == this->seqnr)
                        {
+                               this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND,
+                                                                                       time_monotonic(NULL));
                                if (!this->initiator)
                                {       /* queue DPD_ACK */
                                        this->ike_sa->queue_task(this->ike_sa,