child-cfg: Allow suppressing log messages when selecting traffic selectors
Although being already logged on level 2, these messages are usually just confusing if they pop up randomly in the log when e.g. querying the configs or installing traps. So after this the log messages will only be logged when actually proposing or selecting traffic selectors during IKE.
This commit is contained in:
@@ -289,7 +289,7 @@ METHOD(child_cfg_t, add_traffic_selector, void,
|
||||
|
||||
METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
|
||||
private_child_cfg_t *this, bool local, linked_list_t *supplied,
|
||||
linked_list_t *hosts)
|
||||
linked_list_t *hosts, bool log)
|
||||
{
|
||||
enumerator_t *e1, *e2;
|
||||
traffic_selector_t *ts1, *ts2, *selected;
|
||||
@@ -334,13 +334,19 @@ METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
|
||||
}
|
||||
e1->destroy(e1);
|
||||
|
||||
DBG2(DBG_CFG, "%s traffic selectors for %s:",
|
||||
supplied ? "selecting" : "proposing", local ? "us" : "other");
|
||||
if (supplied == NULL)
|
||||
if (log)
|
||||
{
|
||||
DBG2(DBG_CFG, "%s traffic selectors for %s:",
|
||||
supplied ? "selecting" : "proposing", local ? "us" : "other");
|
||||
}
|
||||
if (!supplied)
|
||||
{
|
||||
while (derived->remove_first(derived, (void**)&ts1) == SUCCESS)
|
||||
{
|
||||
DBG2(DBG_CFG, " %R", ts1);
|
||||
if (log)
|
||||
{
|
||||
DBG2(DBG_CFG, " %R", ts1);
|
||||
}
|
||||
result->insert_last(result, ts1);
|
||||
}
|
||||
derived->destroy(derived);
|
||||
@@ -358,11 +364,14 @@ METHOD(child_cfg_t, get_traffic_selectors, linked_list_t*,
|
||||
selected = ts1->get_subset(ts1, ts2);
|
||||
if (selected)
|
||||
{
|
||||
DBG2(DBG_CFG, " config: %R, received: %R => match: %R",
|
||||
ts1, ts2, selected);
|
||||
if (log)
|
||||
{
|
||||
DBG2(DBG_CFG, " config: %R, received: %R => match: %R",
|
||||
ts1, ts2, selected);
|
||||
}
|
||||
result->insert_last(result, selected);
|
||||
}
|
||||
else
|
||||
else if (log)
|
||||
{
|
||||
DBG2(DBG_CFG, " config: %R, received: %R => no match",
|
||||
ts1, ts2);
|
||||
|
||||
@@ -135,11 +135,13 @@ struct child_cfg_t {
|
||||
* @param local TRUE for TS on local side, FALSE for remote
|
||||
* @param supplied list with TS to select from, or NULL
|
||||
* @param hosts addresses to use for narrowing "dynamic" TS', host_t
|
||||
* @param log FALSE to avoid logging details about the selection
|
||||
* @return list containing the traffic selectors
|
||||
*/
|
||||
linked_list_t *(*get_traffic_selectors)(child_cfg_t *this, bool local,
|
||||
linked_list_t *supplied,
|
||||
linked_list_t *hosts);
|
||||
linked_list_t *hosts, bool log);
|
||||
|
||||
/**
|
||||
* Get the updown script to run for the CHILD_SA.
|
||||
*
|
||||
|
||||
@@ -379,7 +379,7 @@ static int get_ts_match(child_cfg_t *cfg, bool local,
|
||||
int match = 0, round;
|
||||
|
||||
/* fetch configured TS list, narrowing dynamic TS */
|
||||
cfg_list = cfg->get_traffic_selectors(cfg, local, NULL, hosts);
|
||||
cfg_list = cfg->get_traffic_selectors(cfg, local, NULL, hosts, TRUE);
|
||||
|
||||
/* use a round counter to rate leading TS with higher priority */
|
||||
round = sup_list->get_count(sup_list);
|
||||
|
||||
Reference in New Issue
Block a user