shunt-manager: Add an optional namespace for each shunt
This will allow us to reuse the names of child configs e.g. when they are defined in different connections.
This commit is contained in:
@@ -79,7 +79,7 @@ static void bypass_policy_destroy(bypass_policy_t *this)
|
||||
ts = traffic_selector_create_from_subnet(this->net->clone(this->net),
|
||||
this->mask, 0, 0, 65535);
|
||||
DBG1(DBG_IKE, "uninstalling bypass policy for %R", ts);
|
||||
charon->shunts->uninstall(charon->shunts,
|
||||
charon->shunts->uninstall(charon->shunts, "bypass-lan",
|
||||
this->cfg->get_name(this->cfg));
|
||||
this->cfg->destroy(this->cfg);
|
||||
ts->destroy(ts);
|
||||
@@ -173,7 +173,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
|
||||
cfg = child_cfg_create(name, &child);
|
||||
cfg->add_traffic_selector(cfg, FALSE, ts->clone(ts));
|
||||
cfg->add_traffic_selector(cfg, TRUE, ts);
|
||||
charon->shunts->install(charon->shunts, cfg);
|
||||
charon->shunts->install(charon->shunts, "bypass-lan", cfg);
|
||||
DBG1(DBG_IKE, "installed bypass policy for %R", ts);
|
||||
|
||||
INIT(found,
|
||||
|
||||
@@ -641,7 +641,7 @@ static void charon_route(peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
|
||||
mode = child_cfg->get_mode(child_cfg);
|
||||
if (mode == MODE_PASS || mode == MODE_DROP)
|
||||
{
|
||||
if (charon->shunts->install(charon->shunts, child_cfg))
|
||||
if (charon->shunts->install(charon->shunts, NULL, child_cfg))
|
||||
{
|
||||
fprintf(out, "'%s' shunt %N policy installed\n",
|
||||
name, ipsec_mode_names, mode);
|
||||
@@ -733,7 +733,7 @@ METHOD(stroke_control_t, unroute, void,
|
||||
enumerator_t *enumerator;
|
||||
uint32_t id = 0;
|
||||
|
||||
if (charon->shunts->uninstall(charon->shunts, msg->unroute.name))
|
||||
if (charon->shunts->uninstall(charon->shunts, NULL, msg->unroute.name))
|
||||
{
|
||||
fprintf(out, "shunt policy '%s' uninstalled\n", msg->unroute.name);
|
||||
return;
|
||||
|
||||
@@ -603,7 +603,7 @@ METHOD(stroke_list_t, status, void,
|
||||
/* Enumerate shunt policies */
|
||||
first = TRUE;
|
||||
enumerator = charon->shunts->create_enumerator(charon->shunts);
|
||||
while (enumerator->enumerate(enumerator, &child_cfg))
|
||||
while (enumerator->enumerate(enumerator, NULL, &child_cfg))
|
||||
{
|
||||
if (name && !streq(name, child_cfg->get_name(child_cfg)))
|
||||
{
|
||||
|
||||
@@ -235,7 +235,7 @@ static job_requeue_t add_exclude_async(entry_t *entry)
|
||||
enumerator->destroy(enumerator);
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
|
||||
|
||||
charon->shunts->install(charon->shunts, child_cfg);
|
||||
charon->shunts->install(charon->shunts, "unity", child_cfg);
|
||||
child_cfg->destroy(child_cfg);
|
||||
|
||||
DBG1(DBG_IKE, "installed %N bypass policy for %R",
|
||||
@@ -310,7 +310,8 @@ static bool remove_exclude(private_unity_handler_t *this, chunk_t data)
|
||||
DBG1(DBG_IKE, "uninstalling %N bypass policy for %R",
|
||||
configuration_attribute_type_names, UNITY_LOCAL_LAN, ts);
|
||||
ts->destroy(ts);
|
||||
success = charon->shunts->uninstall(charon->shunts, name) && success;
|
||||
success = charon->shunts->uninstall(charon->shunts, "unity",
|
||||
name) && success;
|
||||
}
|
||||
list->destroy(list);
|
||||
return success;
|
||||
|
||||
@@ -1757,7 +1757,7 @@ static void run_start_action(private_vici_config_t *this, peer_cfg_t *peer_cfg,
|
||||
{
|
||||
case MODE_PASS:
|
||||
case MODE_DROP:
|
||||
charon->shunts->install(charon->shunts, child_cfg);
|
||||
charon->shunts->install(charon->shunts, NULL, child_cfg);
|
||||
break;
|
||||
default:
|
||||
charon->traps->install(charon->traps, peer_cfg, child_cfg,
|
||||
@@ -1865,7 +1865,7 @@ static void clear_start_action(private_vici_config_t *this, char *peer_name,
|
||||
{
|
||||
case MODE_PASS:
|
||||
case MODE_DROP:
|
||||
charon->shunts->uninstall(charon->shunts, name);
|
||||
charon->shunts->uninstall(charon->shunts, NULL, name);
|
||||
break;
|
||||
default:
|
||||
enumerator = charon->traps->create_enumerator(charon->traps);
|
||||
|
||||
@@ -565,7 +565,7 @@ CALLBACK(install, vici_message_t*,
|
||||
{
|
||||
case MODE_PASS:
|
||||
case MODE_DROP:
|
||||
ok = charon->shunts->install(charon->shunts, child_cfg);
|
||||
ok = charon->shunts->install(charon->shunts, NULL, child_cfg);
|
||||
break;
|
||||
default:
|
||||
ok = charon->traps->install(charon->traps, peer_cfg, child_cfg,
|
||||
@@ -594,7 +594,7 @@ CALLBACK(uninstall, vici_message_t*,
|
||||
|
||||
DBG1(DBG_CFG, "vici uninstall '%s'", child);
|
||||
|
||||
if (charon->shunts->uninstall(charon->shunts, child))
|
||||
if (charon->shunts->uninstall(charon->shunts, NULL, child))
|
||||
{
|
||||
return send_reply(this, NULL);
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ CALLBACK(list_policies, vici_message_t*,
|
||||
if (drop || pass)
|
||||
{
|
||||
enumerator = charon->shunts->create_enumerator(charon->shunts);
|
||||
while (enumerator->enumerate(enumerator, &child_cfg))
|
||||
while (enumerator->enumerate(enumerator, NULL, &child_cfg))
|
||||
{
|
||||
if (child && !streq(child, child_cfg->get_name(child_cfg)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user