summaryrefslogtreecommitdiff
path: root/zebra/zebra_ns.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-02-15 21:34:04 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-09 11:07:41 -0500
commit43fe6a2a7377d7a214bcc0afd599edd697a44e5d (patch)
tree51790f6bb6edfcc6d86adfb3ed3e4126f85f8da9 /zebra/zebra_ns.c
parent1fbfe5a57249d907b44b31f9031b27eb59a606d4 (diff)
zebra: Keep track of rules written
Keep track of rules written into the kernel. This will allow us to delete them on shutdown if we are not cleaned up properly. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_ns.c')
-rw-r--r--zebra/zebra_ns.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 580ff3eec1..192e8ad413 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -36,6 +36,7 @@
#include "debug.h"
#include "zebra_netns_notify.h"
#include "zebra_netns_id.h"
+#include "zebra_pbr.h"
extern struct zebra_privs_t zserv_privs;
@@ -211,12 +212,15 @@ int zebra_ns_disable(ns_id_t ns_id, void **info)
struct zebra_ns_table *znst;
struct zebra_ns *zns = (struct zebra_ns *)(*info);
+ hash_clean(zns->rules_hash, zebra_pbr_rules_free);
+ hash_free(zns->rules_hash);
while (!RB_EMPTY(zebra_ns_table_head, &zns->ns_tables)) {
znst = RB_ROOT(zebra_ns_table_head, &zns->ns_tables);
RB_REMOVE(zebra_ns_table_head, &zns->ns_tables, znst);
zebra_ns_free_table(znst);
}
+
route_table_finish(zns->if_table);
zebra_vxlan_ns_disable(zns);
#if defined(HAVE_RTADV)
@@ -257,6 +261,9 @@ int zebra_ns_init(void)
/* Default NS is activated */
zebra_ns_enable(ns_id, (void **)&dzns);
+ dzns->rules_hash =
+ hash_create_size(8, zebra_pbr_rules_hash_key,
+ zebra_pbr_rules_hash_equal, "Rules Hash");
if (vrf_is_backend_netns()) {
ns_add_hook(NS_NEW_HOOK, zebra_ns_new);
ns_add_hook(NS_ENABLE_HOOK, zebra_ns_enabled);