controller: Add parameter for maximum log level to initiate/terminate_*()

Previously, the logger installed by the controller always announced
LEVEL_PRIVATE(4), which produced completely useless logging calls with
the common clients (vici/stroke) whose default log level is LEVEL_CTRL(1).
This can produce quite some overhead if there are e.g. a lot of concurrent
initiate() calls.
This commit is contained in:
Tobias Brunner
2023-04-27 13:52:34 +02:00
parent 77b9f3abb0
commit d96d15b588
18 changed files with 60 additions and 46 deletions
+3 -3
View File
@@ -2252,7 +2252,7 @@ static void run_start_action(private_vici_config_t *this, peer_cfg_t *peer_cfg,
DBG1(DBG_CFG, "initiating '%s'", child_cfg->get_name(child_cfg));
charon->controller->initiate(charon->controller,
peer_cfg->get_ref(peer_cfg), child_cfg->get_ref(child_cfg),
NULL, NULL, 0, FALSE);
NULL, NULL, 0, 0, FALSE);
}
}
@@ -2348,7 +2348,7 @@ static void clear_start_action(private_vici_config_t *this, char *peer_name,
{
DBG1(DBG_CFG, "closing '%s' #%u", name, id);
charon->controller->terminate_child(charon->controller,
id, NULL, NULL, 0);
id, NULL, NULL, 0, 0);
}
array_destroy(ids);
}
@@ -2358,7 +2358,7 @@ static void clear_start_action(private_vici_config_t *this, char *peer_name,
{
DBG1(DBG_CFG, "closing IKE_SA #%u", id);
charon->controller->terminate_ike(charon->controller, id,
FALSE, NULL, NULL, 0);
FALSE, NULL, NULL, 0, 0);
}
array_destroy(ikeids);
}
+4 -4
View File
@@ -209,8 +209,8 @@ CALLBACK(initiate, vici_message_t*,
{
return send_reply(this, "%s config '%s' not found", type, sa);
}
switch (charon->controller->initiate(charon->controller, peer_cfg,
child_cfg, log_cb, &log, timeout, limits))
switch (charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
log_cb, &log, log.level, timeout, limits))
{
case SUCCESS:
return send_reply(this, NULL);
@@ -328,7 +328,7 @@ CALLBACK(terminate, vici_message_t*,
if (child || child_id)
{
if (charon->controller->terminate_child(charon->controller, *del,
log_cb, &log, timeout) == SUCCESS)
log_cb, &log, log.level, timeout) == SUCCESS)
{
done++;
}
@@ -336,7 +336,7 @@ CALLBACK(terminate, vici_message_t*,
else
{
if (charon->controller->terminate_ike(charon->controller, *del, force,
log_cb, &log, timeout) == SUCCESS)
log_cb, &log, log.level, timeout) == SUCCESS)
{
done++;
}