child-cfg: Add flag to suppress log message when retrieving proposals

This commit is contained in:
Tobias Brunner
2026-05-28 14:40:25 +02:00
parent bff405c349
commit 60adb95f58
5 changed files with 12 additions and 9 deletions
+5 -3
View 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;
}
+2 -1
View 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.
+2 -2
View 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);
+2 -2
View 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;
+1 -1
View 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);