summaryrefslogtreecommitdiff
path: root/lib/ns.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-01-22 09:42:53 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-02-27 11:10:41 +0100
commit78dd30b263948ffb1d5c22592ef2d70b331bf071 (patch)
treeef8f2a8f59daed17b0f7453d0aac6241f3f41e0d /lib/ns.c
parentac3133a35d340a765be1518c2669b979e39fbe66 (diff)
zebra: add a runtime flag to enable vrf with netns
The netns backend is chosen by VRF if a runtime flag named vrfwnetns is selected when running zebra. In the case the NETNS backend is chosen, in some case the VRFID value is being assigned the value of the NSID. Within the perimeter of that work, this is why the vrf_lookup_by_table function is extended with a new parameter. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/ns.c')
-rw-r--r--lib/ns.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ns.c b/lib/ns.c
index 0b2a3bec78..e3a1d9d0dc 100644
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -378,7 +378,9 @@ static int ns_config_write(struct vty *vty)
struct ns *ns;
int write = 0;
- RB_FOREACH (ns, ns_head, &ns_tree) {
+ if (vrf_is_backend_netns())
+ return 0;
+ RB_FOREACH(ns, ns_head, &ns_tree) {
if (ns->ns_id == NS_DEFAULT || ns->name == NULL)
continue;
@@ -411,7 +413,7 @@ void ns_init(void)
exit(1);
}
- if (have_netns()) {
+ if (have_netns() && !vrf_is_backend_netns()) {
/* Install NS commands. */
install_node(&ns_node, ns_config_write);
install_element(CONFIG_NODE, &ns_netns_cmd);