Clean up IKE_SA state if IKE_SA_INIT request does not have message ID 0
[strongswan.git] / src / libcharon / sa / ikev2 / task_manager_v2.c
index 29d8d83..a53c06b 100644 (file)
@@ -1175,6 +1175,10 @@ METHOD(task_manager_t, process_message, status_t,
                {
                        DBG1(DBG_IKE, "received message ID %d, expected %d. Ignored",
                                 mid, this->responding.mid);
+                       if (msg->get_exchange_type(msg) == IKE_SA_INIT)
+                       {       /* clean up IKE_SA state if IKE_SA_INIT has invalid msg ID */
+                               return DESTROY_ME;
+                       }
                }
        }
        else