summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_ns.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-03-26 12:22:18 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-04-13 16:40:32 +0200
commit03aff2d8489e91b493ad24b8d8d8918831e156d8 (patch)
tree304e168835778c15f11d2c2ba9d96109e944dcb4 /zebra/zebra_ns.c
parentlib: a vrf is searched first by its name, than its vrf id (diff)
downloadfrr-03aff2d8489e91b493ad24b8d8d8918831e156d8.tar.xz
frr-03aff2d8489e91b493ad24b8d8d8918831e156d8.zip
zebra: add an indirection table for ns_id
This list "table" is created in the case the netns backend for VRF is used. This contains the mapping between the NSID value read from the 'ip netns list' and the ns id external used to create the VRF value from vrf context. This mapping is necessary in order to reserve default 0 value for vrf_default. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to '')
-rw-r--r--zebra/zebra_ns.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c
index 7393f767a..52cf4351b 100644
--- a/zebra/zebra_ns.c
+++ b/zebra/zebra_ns.c
@@ -274,6 +274,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 +283,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 +296,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);