]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ike-mobike: Support exchange between IKE_SA_INIT and IKE_AUTH
authorTobias Brunner <tobias@strongswan.org>
Mon, 25 Jun 2018 12:03:56 +0000 (14:03 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 29 Jun 2022 08:28:50 +0000 (10:28 +0200)
This changes the MID of the first IKE_AUTH message.

src/libcharon/sa/ikev2/tasks/ike_mobike.c

index ad47e6a2296090142ee65c576bf9d3a183722464..5cfc72d7898f154d8b36193edcdf6ca240c1f258 100644 (file)
@@ -366,11 +366,12 @@ METHOD(ike_mobike_t, transmit, bool,
 METHOD(task_t, build_i, status_t,
           private_ike_mobike_t *this, message_t *message)
 {
-       if (message->get_exchange_type(message) == IKE_AUTH &&
-               message->get_message_id(message) == 1)
-       {       /* only in first IKE_AUTH */
+       if (message->get_exchange_type(message) == IKE_AUTH)
+       {
                message->add_notify(message, FALSE, MOBIKE_SUPPORTED, chunk_empty);
                build_address_list(this, message);
+               /* only in first IKE_AUTH */
+               this->public.task.build = (void*)return_need_more;
        }
        else if (message->get_exchange_type(message) == INFORMATIONAL)
        {
@@ -424,10 +425,11 @@ METHOD(task_t, build_i, status_t,
 METHOD(task_t, process_r, status_t,
           private_ike_mobike_t *this, message_t *message)
 {
-       if (message->get_exchange_type(message) == IKE_AUTH &&
-               message->get_message_id(message) == 1)
-       {       /* only first IKE_AUTH */
+       if (message->get_exchange_type(message) == IKE_AUTH)
+       {
                process_payloads(this, message);
+               /* only first IKE_AUTH */
+               this->public.task.process = (void*)return_need_more;
        }
        else if (message->get_exchange_type(message) == INFORMATIONAL)
        {
@@ -473,7 +475,7 @@ METHOD(task_t, build_r, status_t,
 {
        if (message->get_exchange_type(message) == IKE_AUTH &&
                this->ike_sa->get_state(this->ike_sa) == IKE_ESTABLISHED)
-       {
+       {       /* in last IKE_AUTH only */
                if (this->ike_sa->supports_extension(this->ike_sa, EXT_MOBIKE))
                {
                        message->add_notify(message, FALSE, MOBIKE_SUPPORTED, chunk_empty);
@@ -502,7 +504,7 @@ METHOD(task_t, process_i, status_t,
 {
        if (message->get_exchange_type(message) == IKE_AUTH &&
                this->ike_sa->get_state(this->ike_sa) == IKE_ESTABLISHED)
-       {
+       {       /* in last IKE_AUTH only */
                process_payloads(this, message);
                return SUCCESS;
        }
@@ -642,6 +644,7 @@ METHOD(task_t, migrate, void,
        {
                this->natd->task.migrate(&this->natd->task, ike_sa);
        }
+       this->public.task.build = _build_i;
 }
 
 METHOD(task_t, destroy, void,