ike-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 60adb95f58
commit eb9e44f783
5 changed files with 11 additions and 8 deletions
+5 -3
View File
@@ -318,7 +318,7 @@ METHOD(ike_cfg_t, add_proposal, void,
}
METHOD(ike_cfg_t, get_proposals, linked_list_t*,
private_ike_cfg_t *this)
private_ike_cfg_t *this, bool log)
{
enumerator_t *enumerator;
proposal_t *current;
@@ -333,8 +333,10 @@ METHOD(ike_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
@@ -178,9 +178,10 @@ struct ike_cfg_t {
*
* Returned list and its proposals must be destroyed after use.
*
* @param log whether to log the configured proposals
* @return list containing all the proposals
*/
linked_list_t* (*get_proposals) (ike_cfg_t *this);
linked_list_t *(*get_proposals)(ike_cfg_t *this, bool log);
/**
* Select a proposal from a list of supplied proposals.
@@ -240,7 +240,7 @@ METHOD(task_t, build_i, status_t,
FALSE);
}
this->lifetime += this->peer_cfg->get_over_time(this->peer_cfg);
proposals = ike_cfg->get_proposals(ike_cfg);
proposals = ike_cfg->get_proposals(ike_cfg, TRUE);
sa_payload = sa_payload_create_from_proposals_v1(proposals,
this->lifetime, 0, this->method, MODE_NONE,
ENCAP_NONE, 0);
+1 -1
View File
@@ -271,7 +271,7 @@ METHOD(task_t, build_i, status_t,
FALSE);
}
this->lifetime += this->peer_cfg->get_over_time(this->peer_cfg);
proposals = ike_cfg->get_proposals(ike_cfg);
proposals = ike_cfg->get_proposals(ike_cfg, TRUE);
sa_payload = sa_payload_create_from_proposals_v1(proposals,
this->lifetime, 0, this->method, MODE_NONE,
ENCAP_NONE, 0);
+2 -2
View File
@@ -367,7 +367,7 @@ static bool build_payloads(private_ike_init_t *this, message_t *message)
if (this->initiator)
{
proposal_list = ike_cfg->get_proposals(ike_cfg);
proposal_list = ike_cfg->get_proposals(ike_cfg, TRUE);
other_ke_methods = linked_list_create();
enumerator = proposal_list->create_enumerator(proposal_list);
while (enumerator->enumerate(enumerator, (void**)&proposal))
@@ -1216,7 +1216,7 @@ static void raise_alerts(private_ike_init_t *this, notify_type_t type)
{
case NO_PROPOSAL_CHOSEN:
ike_cfg = this->ike_sa->get_ike_cfg(this->ike_sa);
list = ike_cfg->get_proposals(ike_cfg);
list = ike_cfg->get_proposals(ike_cfg, FALSE);
charon->bus->alert(charon->bus, ALERT_PROPOSAL_MISMATCH_IKE, list);
list->destroy_offset(list, offsetof(proposal_t, destroy));
break;