]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
child-cfg: Add flag to suppress log message when retrieving proposals
authorTobias Brunner <tobias@strongswan.org>
Thu, 21 May 2026 15:14:31 +0000 (17:14 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 28 May 2026 12:40:25 +0000 (14:40 +0200)
src/libcharon/config/child_cfg.c
src/libcharon/config/child_cfg.h
src/libcharon/sa/ikev1/tasks/quick_mode.c
src/libcharon/sa/ikev2/tasks/child_create.c
src/libcharon/sa/trap_manager.c

index 3e18a4af2f2817d748c6a1c7b20d8f26d2d89819..e1e2778a7b7654c854cd7102efed9bca29093851 100644 (file)
@@ -216,7 +216,7 @@ CALLBACK(match_proposal, bool,
 }
 
 METHOD(child_cfg_t, get_proposals, linked_list_t*,
-       private_child_cfg_t *this, bool strip_ke)
+       private_child_cfg_t *this, bool strip_ke, bool log)
 {
        enumerator_t *enumerator;
        proposal_t *current;
@@ -241,8 +241,10 @@ METHOD(child_cfg_t, get_proposals, linked_list_t*,
        }
        enumerator->destroy(enumerator);
 
-       DBG2(DBG_CFG, "configured proposals: %#P", proposals);
-
+       if (log)
+       {
+               DBG2(DBG_CFG, "configured proposals: %#P", proposals);
+       }
        return proposals;
 }
 
index 258af040aa27f8e7a94e9301d859d47f7a951661..bdeebca4ce8041a1ad0d416d7294384fc842fd45 100644 (file)
@@ -91,9 +91,10 @@ struct child_cfg_t {
         * Resulting list and all of its proposals must be freed after use.
         *
         * @param strip_ke              TRUE strip out key exchange methods
+        * @param log                   whether to log the configured proposals
         * @return                              list of proposals
         */
-       linked_list_t* (*get_proposals)(child_cfg_t *this, bool strip_ke);
+       linked_list_t* (*get_proposals)(child_cfg_t *this, bool strip_ke, bool log);
 
        /**
         * Select a proposal from a supplied list.
index 8c06db5238ed19bd82ec6aa9fbda844844cb44d0..bafe46af062dfbd7d1b2bd199ae87db45c0db3f5 100644 (file)
@@ -802,7 +802,7 @@ static linked_list_t *get_proposals(private_quick_mode_t *this,
        proposal_t *proposal;
        enumerator_t *enumerator;
 
-       list = this->config->get_proposals(this->config, FALSE);
+       list = this->config->get_proposals(this->config, FALSE, TRUE);
        enumerator = list->create_enumerator(list);
        while (enumerator->enumerate(enumerator, &proposal))
        {
@@ -864,7 +864,7 @@ METHOD(task_t, build_i, status_t,
                                }
                        }
 
-                       list = this->config->get_proposals(this->config, FALSE);
+                       list = this->config->get_proposals(this->config, FALSE, TRUE);
                        if (list->get_first(list, (void**)&proposal) == SUCCESS)
                        {
                                this->proto = proposal->get_protocol(proposal);
index 149808ee20cd95a1f4564cf5f2a60f4c6834f56f..13ea7be479635aafb3349a5574f40ff4bc4188ef 100644 (file)
@@ -1768,7 +1768,7 @@ METHOD(task_t, build_i, status_t,
                                                                                                           OPT_PER_CPU_SAS);
        }
 
-       this->proposals = this->config->get_proposals(this->config, no_ke);
+       this->proposals = this->config->get_proposals(this->config, no_ke, TRUE);
        this->mode = this->config->get_mode(this->config);
 
        this->child.if_id_in_def = this->ike_sa->get_if_id(this->ike_sa, TRUE);
@@ -2486,7 +2486,7 @@ static void raise_alerts(private_child_create_t *this, notify_type_t type)
        switch (type)
        {
                case NO_PROPOSAL_CHOSEN:
-                       list = this->config->get_proposals(this->config, FALSE);
+                       list = this->config->get_proposals(this->config, FALSE, FALSE);
                        charon->bus->alert(charon->bus, ALERT_PROPOSAL_MISMATCH_CHILD, list);
                        list->destroy_offset(list, offsetof(proposal_t, destroy));
                        break;
index 90a29b29bf5eab70fe8beb46e6d1bf45c1be6b41..9a4f08d0782f8c7466de6028ec72d8f4b9275880 100644 (file)
@@ -219,7 +219,7 @@ static status_t install_trap(child_sa_t *child_sa, linked_list_t *local,
 
        /* we don't know the finally negotiated protocol (ESP|AH), we install
         * the SA with the protocol of the first proposal */
-       proposals = child->get_proposals(child, TRUE);
+       proposals = child->get_proposals(child, TRUE, FALSE);
        if (proposals->get_first(proposals, (void**)&proposal) == SUCCESS)
        {
                proto = proposal->get_protocol(proposal);