#include <common/hash.h>
#include <common/errors.h>
#include <proto/log.h>
+#include <proto/signal.h>
#include <types/global.h>
/* Opens the namespace <ns_name> and returns the FD or -1 in case of error
static struct eb_root namespace_tree_root = EB_ROOT;
+static void netns_sig_stop(struct sig_handler *sh)
+{
+ struct ebpt_node *node, *next;
+ struct netns_entry *entry;
+
+ /* close namespace file descriptors and remove registered namespaces from the
+ * tree when stopping */
+ node = ebpt_first(&namespace_tree_root);
+ while (node) {
+ next = ebpt_next(node);
+ ebpt_delete(node);
+ entry = container_of(node, struct netns_entry, node);
+ free(entry->node.key);
+ close(entry->fd);
+ node = next;
+ }
+}
+
int netns_init(void)
{
int err_code = 0;
}
}
+ signal_register_fct(0, netns_sig_stop, 0);
+
return err_code;
}