diff options
Diffstat (limited to 'vtysh/vtysh.c')
| -rw-r--r-- | vtysh/vtysh.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index dd3f448674..5cee0aaa3f 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -478,14 +478,6 @@ static int vtysh_execute_func(const char *line, int pager) if (vline == NULL) return CMD_SUCCESS; - if (user_mode) { - if (strncmp("en", vector_slot(vline, 0), 2) == 0) { - cmd_free_strvec(vline); - vty_out(vty, "%% Command not allowed: enable\n"); - return CMD_WARNING; - } - } - if (vtysh_add_timestamp && strncmp(line, "exit", 4)) { char ts[48]; @@ -2803,6 +2795,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]; @@ -2907,6 +2911,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, @@ -4445,13 +4463,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); @@ -4485,7 +4504,8 @@ void vtysh_init_vty(void) /* vtysh */ - install_element(VIEW_NODE, &vtysh_enable_cmd); + if (!user_mode) + install_element(VIEW_NODE, &vtysh_enable_cmd); install_element(ENABLE_NODE, &vtysh_config_terminal_cmd); install_element(ENABLE_NODE, &vtysh_disable_cmd); |
