diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-10-02 13:34:40 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2020-05-18 14:11:03 +0200 |
commit | 9d3555e06ccc68fe37e0a00100029ac4bad8dee2 (patch) | |
tree | 2d280fa3fda993385d84e074f0cb20b0aaab4fab /zebra | |
parent | zebra, lib: add an internal API to get relative default nsid in other ns (diff) | |
download | frr-9d3555e06ccc68fe37e0a00100029ac4bad8dee2.tar.xz frr-9d3555e06ccc68fe37e0a00100029ac4bad8dee2.zip |
zebra, lib: store relative default ns id in each namespace
to be able to retrieve the network namespace identifier for each
namespace, the ns id is stored in each ns context. For default
namespace, the netns id is the same as that value.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_netns_notify.c | 4 | ||||
-rw-r--r-- | zebra/zebra_ns.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 105886bb6..0e2c1684d 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -109,7 +109,9 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name) } frr_with_privs(&zserv_privs) { ret = vrf_netns_handler_create(NULL, vrf, netnspath, - ns_id_external, ns_id); + ns_id_external, + ns_id, + ns_id_relative); } if (ret != CMD_SUCCESS) { flog_warn(EC_ZEBRA_NS_VRF_CREATION_FAILED, diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 4e23ca2f0..13864cd42 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -183,12 +183,16 @@ int zebra_ns_init(const char *optional_default_name) struct ns *default_ns; ns_id_t ns_id; ns_id_t ns_id_external; + struct ns *ns; frr_with_privs(&zserv_privs) { ns_id = zebra_ns_id_get_default(); } ns_id_external = ns_map_nsid_with_external(ns_id, true); ns_init_management(ns_id_external, ns_id); + ns = ns_get_default(); + if (ns) + ns->relative_default_ns = ns_id; default_ns = ns_lookup(ns_get_default_id()); if (!default_ns) { |