ike: Trigger CHILD_INSTALLED state change after corresponding log message
authorTobias Brunner <tobias@strongswan.org>
Tue, 20 Jun 2017 10:01:24 +0000 (12:01 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 27 Jul 2017 11:07:23 +0000 (13:07 +0200)
This way we get the log message in stroke and swanctl as last message
when establishing a connection. It's already like this for the IKE_SA
where IKE_ESTABLISHED is set after the corresponding log message.

Fixes #2364.

src/libcharon/sa/ikev1/tasks/quick_mode.c
src/libcharon/sa/ikev2/tasks/child_create.c

index 8be82eb..49b476a 100644 (file)
@@ -396,10 +396,6 @@ static bool install(private_quick_mode_t *this)
        charon->bus->child_keys(charon->bus, this->child_sa, this->initiator,
                                                        this->dh, this->nonce_i, this->nonce_r);
 
-       /* add to IKE_SA, and remove from task */
-       this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
-       this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
-
        my_ts = linked_list_create_from_enumerator(
                                this->child_sa->create_ts_enumerator(this->child_sa, TRUE));
        other_ts = linked_list_create_from_enumerator(
@@ -415,6 +411,9 @@ static bool install(private_quick_mode_t *this)
        my_ts->destroy(my_ts);
        other_ts->destroy(other_ts);
 
+       this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
+       this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
+
        if (this->rekey)
        {
                old = this->ike_sa->get_child_sa(this->ike_sa,
index 896cabb..747b9fa 100644 (file)
@@ -745,12 +745,6 @@ static status_t select_and_install(private_child_create_t *this,
        charon->bus->child_keys(charon->bus, this->child_sa, this->initiator,
                                                        this->dh, nonce_i, nonce_r);
 
-       this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
-       this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
-       this->established = TRUE;
-
-       schedule_inactivity_timeout(this);
-
        my_ts = linked_list_create_from_enumerator(
                                this->child_sa->create_ts_enumerator(this->child_sa, TRUE));
        other_ts = linked_list_create_from_enumerator(
@@ -767,6 +761,12 @@ static status_t select_and_install(private_child_create_t *this,
 
        my_ts->destroy(my_ts);
        other_ts->destroy(other_ts);
+
+       this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
+       this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
+       this->established = TRUE;
+
+       schedule_inactivity_timeout(this);
        return SUCCESS;
 }