]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib, vtysh: fix inconsistent VRF commands in vtysh
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 9 Jul 2018 00:16:47 +0000 (21:16 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 13 Aug 2018 21:59:31 +0000 (18:59 -0300)
* Only zebra and pimd call vrf_cmd_init(), so these are the only daemons
  that should receive VRF commands from vtysh;
* "netns NAME" and "no netns NAME" are available only in zebra, write
  custom DEFSHs in vtysh to make it aware of that;
* Remove the "no vrf NAME" definition from vtysh.c and expose the
  original command to vtysh by converting the DEFUN_NOSH to a simple
  DEFUN. This command doesn't change the vty node so there's no need to
  special case it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/vrf.c
vtysh/extract.pl.in
vtysh/vtysh.c

index ca50c1e70e8578f7d09b9047ca54598b4d0b4903..4f29bad5f229f44d8f671971c5f3e3afc8abd55f 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -711,12 +711,12 @@ DEFUN_NOSH (vrf,
        return vrf_handler_create(vty, vrfname, NULL);
 }
 
-DEFUN_NOSH (no_vrf,
-           no_vrf_cmd,
-           "no vrf NAME",
-           NO_STR
-           "Delete a pseudo VRF's configuration\n"
-           "VRF's name\n")
+DEFUN (no_vrf,
+       no_vrf_cmd,
+       "no vrf NAME",
+       NO_STR
+       "Delete a pseudo VRF's configuration\n"
+       "VRF's name\n")
 {
        const char *vrfname = argv[2]->arg;
 
@@ -744,7 +744,7 @@ DEFUN_NOSH (no_vrf,
 
 struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1};
 
-DEFUN (vrf_netns,
+DEFUN_NOSH (vrf_netns,
        vrf_netns_cmd,
        "netns NAME",
        "Attach VRF to a Namespace\n"
@@ -771,7 +771,7 @@ DEFUN (vrf_netns,
        return ret;
 }
 
-DEFUN (no_vrf_netns,
+DEFUN_NOSH (no_vrf_netns,
        no_vrf_netns_cmd,
        "no netns [NAME]",
        NO_STR
index c0277b3d61b798d820c9855bf4409e09637e268c..b93314c9670419cb6263db2b6ee873ebb108881f 100755 (executable)
@@ -85,7 +85,7 @@ foreach (@ARGV) {
             $protocol = "VTYSH_RMAP";
         }
         elsif ($file =~ /lib\/vrf\.c$/) {
-            $protocol = "VTYSH_ALL";
+            $protocol = "VTYSH_VRF";
         }
         elsif ($file =~ /lib\/logicalrouter\.c$/) {
             $protocol = "VTYSH_ALL";
index e25a576926072fe574dd22cd0e6a284f33e32d31..4e24bef9292ea3b917913356a7ab8818ece2af8a 100644 (file)
@@ -2070,9 +2070,16 @@ DEFUNSH(VTYSH_VRF, vtysh_vrf, vtysh_vrf_cmd, "vrf NAME",
        return CMD_SUCCESS;
 }
 
-DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME", NO_STR
-      "Delete a pseudo vrf's configuration\n"
-      "VRF's name\n")
+DEFSH(VTYSH_ZEBRA, vtysh_vrf_netns_cmd,
+      "netns NAME",
+      "Attach VRF to a Namespace\n"
+      "The file name in " NS_RUN_DIR ", or a full pathname\n")
+
+DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_netns_cmd,
+      "no netns [NAME]",
+      NO_STR
+      "Detach VRF from a Namespace\n"
+      "The file name in " NS_RUN_DIR ", or a full pathname\n")
 
 DEFUNSH(VTYSH_NS, vtysh_exit_logicalrouter,
        vtysh_exit_logicalrouter_cmd, "exit",
@@ -3689,10 +3696,11 @@ void vtysh_init_vty(void)
        install_element(ENABLE_NODE, &vtysh_show_running_config_cmd);
        install_element(ENABLE_NODE, &vtysh_copy_running_config_cmd);
 
+       install_element(CONFIG_NODE, &vtysh_vrf_cmd);
+       install_element(VRF_NODE, &vtysh_vrf_netns_cmd);
+       install_element(VRF_NODE, &vtysh_no_vrf_netns_cmd);
        install_element(VRF_NODE, &exit_vrf_config_cmd);
 
-       install_element(CONFIG_NODE, &vtysh_vrf_cmd);
-       install_element(CONFIG_NODE, &vtysh_no_vrf_cmd);
        install_element(CONFIG_NODE, &vtysh_no_nexthop_group_cmd);
 
        /* "write terminal" command. */