]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: netns vty command not available when vrf backend is vrf lite
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 10 Jan 2018 09:04:59 +0000 (10:04 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 27 Feb 2018 10:11:24 +0000 (11:11 +0100)
Using the vrf backend kind, the vty command that configured netns
under vty will not be installed if the vrf backend is vrf lite

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/ns.c

index 25136d0a1e898afc2acad10f49e74c63e18535a8..fcac28cf7e06754be42c82d83eb3926d5b07351a 100644 (file)
--- a/lib/ns.c
+++ b/lib/ns.c
@@ -492,6 +492,10 @@ DEFUN (no_ns_netns,
 
        VTY_DECLVAR_CONTEXT(vrf, vrf);
 
+       if (!vrf_is_backend_netns()) {
+               vty_out(vty, "VRF backend is not Netns. Aborting\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
        if (!vrf->ns_ctxt) {
                vty_out(vty, "VRF %s(%u) is not configured with NetNS\n",
                        vrf->name, vrf->vrf_id);
@@ -538,7 +542,7 @@ void ns_init(void)
 
 void ns_cmd_init(void)
 {
-       if (have_netns()) {
+       if (have_netns() && vrf_is_backend_netns()) {
                /* Install NS commands. */
                install_element(VRF_NODE, &ns_netns_cmd);
                install_element(VRF_NODE, &no_ns_netns_cmd);