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
+8 -4
View File
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2012-2023 Tobias Brunner
* Copyright (C) 2007 Martin Willi
*
* Copyright (C) secunet Security Networks AG
@@ -82,6 +83,7 @@ struct controller_t {
* @param child_cfg optional child_cfg to set up CHILD_SA from
* @param cb logging callback
* @param param parameter to include in each call of cb
* @param max_level maximum log level for which cb is invoked
* @param timeout timeout in ms to wait for callbacks, 0 to disable
* @param limits whether to check limits regarding IKE_SA initiation
* @return
@@ -93,8 +95,8 @@ struct controller_t {
*/
status_t (*initiate)(controller_t *this,
peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
controller_cb_t callback, void *param, u_int timeout,
bool limits);
controller_cb_t callback, void *param,
level_t max_level, u_int timeout, bool limits);
/**
* Terminate an IKE_SA and all of its CHILD_SAs.
@@ -110,6 +112,7 @@ struct controller_t {
* retransmits are sent until then
* @param cb logging callback
* @param param parameter to include in each call of cb
* @param max_level maximum log level for which cb is invoked
* @param timeout timeout in ms to wait for callbacks, 0 to disable
* @return
* - SUCCESS, if CHILD_SA terminated
@@ -119,7 +122,7 @@ struct controller_t {
*/
status_t (*terminate_ike)(controller_t *this, uint32_t unique_id,
bool force, controller_cb_t callback, void *param,
u_int timeout);
level_t max_level, u_int timeout);
/**
* Terminate a CHILD_SA.
@@ -130,6 +133,7 @@ struct controller_t {
* @param unique_id CHILD_SA unique ID to terminate
* @param cb logging callback
* @param param parameter to include in each call of cb
* @param max_level maximum log level for which cb is invoked
* @param timeout timeout in ms to wait for callbacks, 0 to disable
* @return
* - SUCCESS, if CHILD_SA terminated
@@ -139,7 +143,7 @@ struct controller_t {
*/
status_t (*terminate_child)(controller_t *this, uint32_t unique_id,
controller_cb_t callback, void *param,
u_int timeout);
level_t max_level, u_int timeout);
/**
* Destroy a controller_t instance.