ikev1: Respond to DPDs for rekeyed IKE_SAs
authorTobias Brunner <tobias@strongswan.org>
Mon, 13 Feb 2017 10:54:53 +0000 (11:54 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 17 Feb 2017 10:37:24 +0000 (11:37 +0100)
Some devices always use the oldest IKE_SA to send DPDs and will delete
all IKE_SAs when there is no response. If uniqueness is not enforced
rekeyed IKE_SAs might not get deleted until they expire so we should
respond to DPDs.

References #2090.

src/libcharon/sa/ike_sa.c
src/libcharon/sa/ikev1/task_manager_v1.c

index 76294ce..76e1069 100644 (file)
@@ -762,6 +762,10 @@ METHOD(ike_sa_t, send_dpd, status_t,
        {
                return INVALID_STATE;
        }
+       if (this->version == IKEV1 && this->state == IKE_REKEYING)
+       {       /* don't send DPDs for rekeyed IKEv1 SAs */
+               return SUCCESS;
+       }
        delay = this->peer_cfg->get_dpd(this->peer_cfg);
        if (this->task_manager->busy(this->task_manager))
        {
index 7c8eeba..1da17ee 100644 (file)
@@ -552,6 +552,12 @@ METHOD(task_manager_t, initiate, status_t,
                                        new_mid = TRUE;
                                        break;
                                }
+                               if (activate_task(this, TASK_ISAKMP_DPD))
+                               {
+                                       exchange = INFORMATIONAL_V1;
+                                       new_mid = TRUE;
+                                       break;
+                               }
                                break;
                        default:
                                break;