summaryrefslogtreecommitdiff
path: root/zebra/zebra_ns.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_ns.c')
-rw-r--r--zebra/zebra_ns.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 7393f767af..5c62e366a6 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -140,6 +140,20 @@ int zebra_ns_enable(ns_id_t ns_id, void **info)
hash_create_size(8, zebra_pbr_rules_hash_key,
zebra_pbr_rules_hash_equal, "Rules Hash");
+ zns->ipset_hash =
+ hash_create_size(8, zebra_pbr_ipset_hash_key,
+ zebra_pbr_ipset_hash_equal, "IPset Hash");
+
+ zns->ipset_entry_hash =
+ hash_create_size(8, zebra_pbr_ipset_entry_hash_key,
+ zebra_pbr_ipset_entry_hash_equal,
+ "IPset Hash Entry");
+
+ zns->iptable_hash =
+ hash_create_size(8, zebra_pbr_iptable_hash_key,
+ zebra_pbr_iptable_hash_equal,
+ "IPtable Hash Entry");
+
#if defined(HAVE_RTADV)
rtadv_init(zns);
#endif
@@ -248,6 +262,15 @@ int zebra_ns_disable(ns_id_t ns_id, void **info)
hash_clean(zns->rules_hash, zebra_pbr_rules_free);
hash_free(zns->rules_hash);
+ hash_clean(zns->ipset_hash, zebra_pbr_ipset_free);
+ hash_free(zns->ipset_hash);
+ hash_clean(zns->ipset_entry_hash,
+ zebra_pbr_ipset_entry_free),
+ hash_free(zns->ipset_entry_hash);
+ hash_clean(zns->iptable_hash,
+ zebra_pbr_iptable_free);
+ hash_free(zns->iptable_hash);
+
while (!RB_EMPTY(zebra_ns_table_head, &zns->ns_tables)) {
znst = RB_ROOT(zebra_ns_table_head, &zns->ns_tables);
@@ -274,6 +297,7 @@ int zebra_ns_disable(ns_id_t ns_id, void **info)
int zebra_ns_init(void)
{
ns_id_t ns_id;
+ ns_id_t ns_id_external;
dzns = zebra_ns_alloc();
@@ -282,8 +306,8 @@ int zebra_ns_init(void)
ns_id = zebra_ns_id_get_default();
if (zserv_privs.change(ZPRIVS_LOWER))
zlog_err("Can't lower privileges");
-
- ns_init_management(ns_id);
+ ns_id_external = ns_map_nsid_with_external(ns_id, true);
+ ns_init_management(ns_id_external, ns_id);
logicalrouter_init(logicalrouter_config_write);
@@ -295,7 +319,7 @@ int zebra_ns_init(void)
zebra_vrf_init();
/* Default NS is activated */
- zebra_ns_enable(ns_id, (void **)&dzns);
+ zebra_ns_enable(ns_id_external, (void **)&dzns);
if (vrf_is_backend_netns()) {
ns_add_hook(NS_NEW_HOOK, zebra_ns_new);