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.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 6bb5e971e6..803d8f0034 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -23,6 +23,7 @@
#include "rib.h"
#include "table_manager.h"
#include "zebra_errors.h"
+#include "zebra_dplane.h"
extern struct zebra_privs_t zserv_privs;
@@ -41,11 +42,6 @@ struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id)
return (info == NULL) ? dzns : info;
}
-static struct zebra_ns *zebra_ns_alloc(void)
-{
- return XCALLOC(MTYPE_ZEBRA_NS, sizeof(struct zebra_ns));
-}
-
static int zebra_ns_new(struct ns *ns)
{
struct zebra_ns *zns;
@@ -56,7 +52,7 @@ static int zebra_ns_new(struct ns *ns)
if (IS_ZEBRA_DEBUG_EVENT)
zlog_info("ZNS %s with id %u (created)", ns->name, ns->ns_id);
- zns = zebra_ns_alloc();
+ zns = XCALLOC(MTYPE_ZEBRA_NS, sizeof(struct zebra_ns));
ns->info = zns;
zns->ns = ns;
zns->ns_id = ns->ns_id;
@@ -101,6 +97,36 @@ int zebra_ns_disabled(struct ns *ns)
return zebra_ns_disable_internal(zns, true);
}
+void zebra_ns_startup_continue(struct zebra_dplane_ctx *ctx)
+{
+ struct zebra_ns *zns = zebra_ns_lookup(dplane_ctx_get_ns_id(ctx));
+ enum zebra_dplane_startup_notifications spot;
+
+ if (!zns) {
+ zlog_err("%s: No Namespace associated with %u", __func__,
+ dplane_ctx_get_ns_id(ctx));
+ return;
+ }
+
+ spot = dplane_ctx_get_startup_spot(ctx);
+
+ switch (spot) {
+ case ZEBRA_DPLANE_INTERFACES_READ:
+ interface_list_tunneldump(zns);
+ break;
+ case ZEBRA_DPLANE_TUNNELS_READ:
+ interface_list_second(zns);
+ break;
+ case ZEBRA_DPLANE_ADDRESSES_READ:
+ route_read(zns);
+
+ vlan_read(zns);
+ kernel_read_pbr_rules(zns);
+ kernel_read_tc_qdisc(zns);
+ break;
+ }
+}
+
/* Do global enable actions - open sockets, read kernel config etc. */
int zebra_ns_enable(ns_id_t ns_id, void **info)
{
@@ -111,11 +137,6 @@ int zebra_ns_enable(ns_id_t ns_id, void **info)
kernel_init(zns);
zebra_dplane_ns_enable(zns, true);
interface_list(zns);
- route_read(zns);
-
- vlan_read(zns);
- kernel_read_pbr_rules(zns);
- kernel_read_tc_qdisc(zns);
return 0;
}
@@ -168,6 +189,8 @@ int zebra_ns_final_shutdown(struct ns *ns,
kernel_terminate(zns, true);
+ zebra_ns_delete(ns);
+
return NS_WALK_CONTINUE;
}
@@ -215,10 +238,3 @@ int zebra_ns_init(void)
return 0;
}
-
-int zebra_ns_config_write(struct vty *vty, struct ns *ns)
-{
- if (ns && ns->name != NULL)
- vty_out(vty, " netns %s\n", ns->name);
- return 0;
-}