]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
child-create: Fix build with DEBUG_LEVEL < 1
authorTobias Brunner <tobias@strongswan.org>
Mon, 1 May 2023 09:59:46 +0000 (11:59 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 May 2023 15:32:17 +0000 (17:32 +0200)
src/libcharon/sa/ikev2/tasks/child_create.c

index daa56a9e5ded78471ba948a402e32f03427e4b31..928264820971f13e4720af52e1181159e33edc1d 100644 (file)
@@ -495,7 +495,6 @@ static status_t select_and_install(private_child_create_t *this,
                                                                   bool no_dh, bool ike_auth)
 {
        status_t status, status_i, status_o;
-       child_sa_outbound_state_t out_state;
        chunk_t nonce_i, nonce_r;
        chunk_t encr_i = chunk_empty, encr_r = chunk_empty;
        chunk_t integ_i = chunk_empty, integ_r = chunk_empty;
@@ -779,11 +778,14 @@ 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);
 
+#if DEBUG_LEVEL >= 0
+       child_sa_outbound_state_t out_state;
+
+       out_state = this->child_sa->get_outbound_state(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(
                                this->child_sa->create_ts_enumerator(this->child_sa, FALSE));
-       out_state = this->child_sa->get_outbound_state(this->child_sa);
 
        DBG0(DBG_IKE, "%sCHILD_SA %s{%d} established "
                 "with SPIs %.8x_i %.8x_o and TS %#R === %#R",
@@ -796,6 +798,7 @@ static status_t select_and_install(private_child_create_t *this,
 
        my_ts->destroy(my_ts);
        other_ts->destroy(other_ts);
+#endif
 
        this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
        this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
@@ -1129,13 +1132,13 @@ static bool check_for_generic_label(private_child_create_t *this)
 {
        if (generic_label_only(this))
        {
-               sec_label_t *label;
-
-               label = this->config->get_label(this->config);
+#if DEBUG_LEVEL >= 1
+               sec_label_t *label = this->config->get_label(this->config);
                DBG1(DBG_IKE, "not establishing CHILD_SA %s{%d} with generic "
                         "label '%s'", this->child_sa->get_name(this->child_sa),
                         this->child_sa->get_unique_id(this->child_sa),
                         label->get_string(label));
+#endif
                return TRUE;
        }
        return FALSE;