]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ike-rekey: Reset IKE_SA after processing CREATE_CHILD_SA request
authorTobias Brunner <tobias@strongswan.org>
Tue, 10 Jul 2018 12:36:28 +0000 (14:36 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 29 Jun 2022 08:28:50 +0000 (10:28 +0200)
This probably didn't cause any problems, as there wasn't really anything
happening between the calls, but reset it anyway, just to be safe.

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

index 1dc0fd6e8e904cb50d3b02f36feef595b76b5860..2e9732a9e4f4778d0d1cec35e5704abec99d871f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Tobias Brunner
+ * Copyright (C) 2015-2018 Tobias Brunner
  * Copyright (C) 2005-2008 Martin Willi
  * Copyright (C) 2005 Jan Hutter
  *
@@ -167,7 +167,7 @@ METHOD(task_t, build_i, status_t,
        ike_version_t version;
 
        /* create new SA only on first try */
-       if (this->new_sa == NULL)
+       if (!this->new_sa)
        {
                version = this->ike_sa->get_version(this->ike_sa);
                this->new_sa = charon->ike_sa_manager->create_new(
@@ -254,7 +254,7 @@ METHOD(task_t, process_r, status_t,
        this->new_sa->inherit_pre(this->new_sa, this->ike_sa);
        this->ike_init = ike_init_create(this->new_sa, FALSE, this->ike_sa);
        this->ike_init->task.process(&this->ike_init->task, message);
-
+       charon->bus->set_sa(charon->bus, this->ike_sa);
        return NEED_MORE;
 }
 
@@ -266,12 +266,14 @@ METHOD(task_t, build_r, status_t,
                message->add_notify(message, TRUE, TEMPORARY_FAILURE, chunk_empty);
                return SUCCESS;
        }
-       if (this->new_sa == NULL)
+       if (!this->new_sa)
        {
                /* IKE_SA/a CHILD_SA is in an unacceptable state, deny rekeying */
                message->add_notify(message, TRUE, NO_PROPOSAL_CHOSEN, chunk_empty);
                return SUCCESS;
        }
+
+       charon->bus->set_sa(charon->bus, this->new_sa);
        if (this->ike_init->task.build(&this->ike_init->task, message) == FAILED)
        {
                this->ike_init->task.destroy(&this->ike_init->task);
@@ -338,7 +340,7 @@ METHOD(task_t, process_i, status_t,
                        }
                        return SUCCESS;
                case NEED_MORE:
-                       /* bad dh group, try again */
+                       /* bad KE method, try again */
                        this->ike_init->task.migrate(&this->ike_init->task, this->new_sa);
                        return NEED_MORE;
                default: