]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: fix exit from zebra-only nodes
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 21 Jul 2021 14:22:14 +0000 (17:22 +0300)
committermergify-bot <noreply@mergify.io>
Fri, 23 Jul 2021 09:32:08 +0000 (09:32 +0000)
When exiting from link-params and pseudowire nodes, we were sending exit
command to all VTYSH_INTERFACE daemons. This led to a desynchronized
state in vtysh and daemons other then zebra. We must send exit command
only to zebra.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 92de4c7fb6ff4fcff6542346381f89ecdc09bbd7)

vtysh/vtysh.c

index 9db4a754702caded0bfb8980a9f30376c8971570..214280894df8b2587bb3af91868ce0e6d04e1571 100644 (file)
@@ -2669,6 +2669,18 @@ DEFUNSH(VTYSH_INTERFACE, vtysh_quit_interface, vtysh_quit_interface_cmd, "quit",
        return vtysh_exit_interface(self, vty, argc, argv);
 }
 
+DEFUNSH(VTYSH_ZEBRA, vtysh_exit_pseudowire, vtysh_exit_pseudowire_cmd, "exit",
+       "Exit current mode and down to previous mode\n")
+{
+       return vtysh_exit(vty);
+}
+
+DEFUNSH(VTYSH_ZEBRA, vtysh_quit_pseudowire, vtysh_quit_pseudowire_cmd, "quit",
+       "Exit current mode and down to previous mode\n")
+{
+       return vtysh_exit_pseudowire(self, vty, argc, argv);
+}
+
 static char *do_prepend(struct vty *vty, struct cmd_token **argv, int argc)
 {
        const char *argstr[argc + 1];
@@ -2775,6 +2787,20 @@ DEFUNSH(VTYSH_ZEBRA, exit_link_params, exit_link_params_cmd, "exit-link-params",
        return CMD_SUCCESS;
 }
 
+DEFUNSH(VTYSH_ZEBRA, vtysh_exit_link_params, vtysh_exit_link_params_cmd, "exit",
+       "Exit current mode and down to previous mode\n")
+{
+       if (vty->node == LINK_PARAMS_NODE)
+               vty->node = INTERFACE_NODE;
+       return CMD_SUCCESS;
+}
+
+DEFUNSH(VTYSH_ZEBRA, vtysh_quit_link_params, vtysh_quit_link_params_cmd, "quit",
+       "Exit current mode and down to previous mode\n")
+{
+       return vtysh_exit_link_params(self, vty, argc, argv);
+}
+
 DEFUNSH_HIDDEN (0x00,
                 vtysh_debug_all,
                 vtysh_debug_all_cmd,
@@ -4305,13 +4331,14 @@ void vtysh_init_vty(void)
        install_element(INTERFACE_NODE, &vtysh_link_params_cmd);
        install_element(LINK_PARAMS_NODE, &exit_link_params_cmd);
        install_element(LINK_PARAMS_NODE, &vtysh_end_all_cmd);
-       install_element(LINK_PARAMS_NODE, &vtysh_exit_interface_cmd);
+       install_element(LINK_PARAMS_NODE, &vtysh_exit_link_params_cmd);
+       install_element(LINK_PARAMS_NODE, &vtysh_quit_link_params_cmd);
 
        install_node(&pw_node);
        install_element(CONFIG_NODE, &vtysh_pseudowire_cmd);
        install_element(PW_NODE, &vtysh_end_all_cmd);
-       install_element(PW_NODE, &vtysh_exit_interface_cmd);
-       install_element(PW_NODE, &vtysh_quit_interface_cmd);
+       install_element(PW_NODE, &vtysh_exit_pseudowire_cmd);
+       install_element(PW_NODE, &vtysh_quit_pseudowire_cmd);
 
        install_node(&vrf_node);
        install_element(CONFIG_NODE, &vtysh_vrf_cmd);