diff options
Diffstat (limited to 'lib/netns_linux.c')
-rw-r--r-- | lib/netns_linux.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 297e2c5..8fa4bc6 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -5,6 +5,7 @@ */ #include <zebra.h> +#include <fcntl.h> #ifdef HAVE_NETNS #undef _GNU_SOURCE @@ -502,12 +503,19 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) void ns_terminate(void) { struct ns *ns; + struct ns_map_nsid *ns_map; while (!RB_EMPTY(ns_head, &ns_tree)) { ns = RB_ROOT(ns_head, &ns_tree); ns_delete(ns); } + + while (!RB_EMPTY(ns_map_nsid_head, &ns_map_nsid_list)) { + ns_map = RB_ROOT(ns_map_nsid_head, &ns_map_nsid_list); + RB_REMOVE(ns_map_nsid_head, &ns_map_nsid_list, ns_map); + XFREE(MTYPE_NS, ns_map); + } } int ns_switch_to_netns(const char *name) |