diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-10-02 12:14:13 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2020-05-18 14:11:03 +0200 |
commit | 97c9e7533bd22029ac19838c043cfca82d2f6eb3 (patch) | |
tree | f15f7a2198a36ca542be6007a98516f23dabc06a /lib/netns_linux.c | |
parent | zebra: map vxlan interface to bridge interface with correct ns id (diff) | |
download | frr-97c9e7533bd22029ac19838c043cfca82d2f6eb3.tar.xz frr-97c9e7533bd22029ac19838c043cfca82d2f6eb3.zip |
zebra, lib: add an internal API to get relative default nsid in other ns
as remind, the netns identifiers are local to a namespace. that is to
say that for instance, a vrf <vrfx> will have a netns id value in one
netns, and have an other netns id value in one other netns.
There is a need for zebra daemon to collect some cross information, like
the LINK_NETNSID information from interfaces having link layer in an
other network namespace. For that, it is needed to have a global
overview instead of a relative overview per namespace.
The first brick of this change is an API that sticks to netlink API,
that uses NETNSA_TARGET_NSID. from a given vrf vrfX, and a new vrf
created vrfY, the API returns the value of nsID from vrfX, inside the
new vrf vrfY.
The brick also gets the ns id value of default namespace in each other
namespace. An additional value in ns.h is offered, that permits to
retrieve the default namespace context.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/netns_linux.c')
-rw-r--r-- | lib/netns_linux.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 09a42b850..bb66e8938 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -590,3 +590,9 @@ ns_id_t ns_get_default_id(void) return default_ns->ns_id; return NS_DEFAULT_INTERNAL; } + +struct ns *ns_get_default(void) +{ + return default_ns; +} + |