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:
@@ -239,8 +239,8 @@ static bool on_accept(private_load_tester_control_t *this, stream_t *io)
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
switch (charon->controller->initiate(charon->controller,
|
||||
peer_cfg, child_cfg->get_ref(child_cfg),
|
||||
(void*)initiate_cb, listener, 0, FALSE))
|
||||
peer_cfg, child_cfg->get_ref(child_cfg),
|
||||
(void*)initiate_cb, listener, LEVEL_CTRL, 0, FALSE))
|
||||
{
|
||||
case NEED_MORE:
|
||||
/* Callback returns FALSE once it got track of this IKE_SA.
|
||||
|
||||
@@ -152,7 +152,7 @@ static job_requeue_t do_load_test(private_load_tester_plugin_t *this)
|
||||
|
||||
charon->controller->initiate(charon->controller,
|
||||
peer_cfg, child_cfg->get_ref(child_cfg),
|
||||
NULL, NULL, 0, FALSE);
|
||||
NULL, NULL, 0, 0, FALSE);
|
||||
if (s)
|
||||
{
|
||||
sleep(s);
|
||||
|
||||
@@ -349,8 +349,8 @@ static job_requeue_t initiate_config(peer_cfg_t *peer_cfg)
|
||||
child_cfg->get_ref(child_cfg);
|
||||
peer_cfg->get_ref(peer_cfg);
|
||||
enumerator->destroy(enumerator);
|
||||
charon->controller->initiate(charon->controller,
|
||||
peer_cfg, child_cfg, NULL, NULL, 0, FALSE);
|
||||
charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
|
||||
NULL, NULL, 0, 0, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -423,13 +423,13 @@ static void request_control_terminate(xmlTextReaderPtr reader,
|
||||
{
|
||||
status = charon->controller->terminate_ike(
|
||||
charon->controller, id, FALSE,
|
||||
(controller_cb_t)xml_callback, writer, 0);
|
||||
(controller_cb_t)xml_callback, writer, LEVEL_CTRL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = charon->controller->terminate_child(
|
||||
charon->controller, id,
|
||||
(controller_cb_t)xml_callback, writer, 0);
|
||||
(controller_cb_t)xml_callback, writer, LEVEL_CTRL, 0);
|
||||
}
|
||||
/* </log> */
|
||||
xmlTextWriterEndElement(writer);
|
||||
@@ -495,7 +495,7 @@ static void request_control_initiate(xmlTextReaderPtr reader,
|
||||
{
|
||||
status = charon->controller->initiate(charon->controller,
|
||||
peer, child, (controller_cb_t)xml_callback,
|
||||
writer, 0, FALSE);
|
||||
writer, LEVEL_CTRL, 0, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ static void charon_initiate(private_stroke_control_t *this, peer_cfg_t *peer_cfg
|
||||
if (msg->output_verbosity < 0)
|
||||
{
|
||||
charon->controller->initiate(charon->controller, peer_cfg, child_cfg,
|
||||
NULL, NULL, 0, FALSE);
|
||||
NULL, NULL, 0, 0, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,7 +118,7 @@ static void charon_initiate(private_stroke_control_t *this, peer_cfg_t *peer_cfg
|
||||
|
||||
status = charon->controller->initiate(charon->controller,
|
||||
peer_cfg, child_cfg, (controller_cb_t)stroke_log,
|
||||
&info, this->timeout, FALSE);
|
||||
&info, msg->output_verbosity, this->timeout, FALSE);
|
||||
switch (status)
|
||||
{
|
||||
case SUCCESS:
|
||||
@@ -312,25 +312,26 @@ static void charon_terminate(private_stroke_control_t *this, uint32_t id,
|
||||
if (child)
|
||||
{
|
||||
status = charon->controller->terminate_child(charon->controller, id,
|
||||
(controller_cb_t)stroke_log, &info, this->timeout);
|
||||
(controller_cb_t)stroke_log, &info,
|
||||
msg->output_verbosity, this->timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = charon->controller->terminate_ike(charon->controller, id,
|
||||
FALSE, (controller_cb_t)stroke_log, &info,
|
||||
this->timeout);
|
||||
FALSE, (controller_cb_t)stroke_log, &info,
|
||||
msg->output_verbosity, this->timeout);
|
||||
}
|
||||
report_terminate_status(this, status, out, id, child);
|
||||
}
|
||||
else if (child)
|
||||
{
|
||||
charon->controller->terminate_child(charon->controller, id,
|
||||
NULL, NULL, 0);
|
||||
NULL, NULL, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
charon->controller->terminate_ike(charon->controller, id, FALSE,
|
||||
NULL, NULL, 0);
|
||||
NULL, NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,8 +147,8 @@ static void initiate(private_uci_control_t *this, char *name)
|
||||
enumerator = peer_cfg->create_child_cfg_enumerator(peer_cfg);
|
||||
if (enumerator->enumerate(enumerator, &child_cfg) &&
|
||||
charon->controller->initiate(charon->controller, peer_cfg,
|
||||
child_cfg->get_ref(child_cfg),
|
||||
controller_cb_empty, NULL, 0, FALSE) == SUCCESS)
|
||||
child_cfg->get_ref(child_cfg), controller_cb_empty,
|
||||
NULL, LEVEL_SILENT, 0, FALSE) == SUCCESS)
|
||||
{
|
||||
write_fifo(this, "connection '%s' established\n", name);
|
||||
}
|
||||
@@ -182,7 +182,8 @@ static void terminate(private_uci_control_t *this, char *name)
|
||||
id = ike_sa->get_unique_id(ike_sa);
|
||||
enumerator->destroy(enumerator);
|
||||
charon->controller->terminate_ike(charon->controller, id, FALSE,
|
||||
controller_cb_empty, NULL, 0);
|
||||
controller_cb_empty, NULL,
|
||||
LEVEL_SILENT, 0);
|
||||
write_fifo(this, "connection '%s' terminated\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user