From: Quentin Young Date: Fri, 23 Sep 2016 20:08:47 +0000 (+0000) Subject: lib: Implement removed ALIAS into DEFUN X-Git-Tag: frr-3.0-branchpoint~129^2~174 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f667a580b74670ceccfcbe33b9f6d76c74265dd6;p=matthieu%2Ffrr.git lib: Implement removed ALIAS into DEFUN N.B.: some of these are de-facto ALIAS resurrections that are necessary due to some parser limitations; these are marked with ALIAS_FIXME so I can go back and add capability to the parser to handle these special cases. Signed-off-by: Quentin Young --- diff --git a/lib/command.c b/lib/command.c index 7cc2c3b23b..d3b3f3a2b5 100644 --- a/lib/command.c +++ b/lib/command.c @@ -952,12 +952,6 @@ DEFUN (disable, } /* Down vty node level. */ -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "quit", - * "Exit current mode and down to previous mode\n" - * - */ DEFUN (config_exit, config_exit_cmd, "exit", @@ -1016,7 +1010,15 @@ DEFUN (config_exit, return CMD_SUCCESS; } -/* quit is alias of exit. */ +/* ALIAS_FIXME */ +DEFUN (config_quit, + config_quit_cmd, + "quit", + "Exit current mode and down to previous mode\n") +{ + return config_exit (self, vty, argc, argv); +} + /* End of configuration. */ DEFUN (config_end, @@ -2143,6 +2145,7 @@ cmd_init (int terminal) install_element (RESTRICTED_NODE, &config_list_cmd); install_element (RESTRICTED_NODE, &config_exit_cmd); + install_element (RESTRICTED_NODE, &config_quit_cmd); install_element (RESTRICTED_NODE, &config_help_cmd); install_element (RESTRICTED_NODE, &config_enable_cmd); install_element (RESTRICTED_NODE, &config_terminal_length_cmd); diff --git a/lib/filter.c b/lib/filter.c index a25c8cdc97..52d6d956d9 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1381,20 +1381,6 @@ DEFUN (access_list_remark, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no access-list (<1-99>|<100-199>|<1300-1999>|<2000-2699>|WORD) remark .LINE", - * NO_STR - * "Add an access list entry\n" - * "IP standard access list\n" - * "IP extended access list\n" - * "IP standard access list (expanded range)\n" - * "IP extended access list (expanded range)\n" - * "IP zebra access-list\n" - * "Access list entry comment\n" - * "Comment up to 100 characters\n" - * - */ DEFUN (no_access_list_remark, no_access_list_remark_cmd, "no access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark", @@ -1409,6 +1395,23 @@ DEFUN (no_access_list_remark, { return vty_access_list_remark_unset (vty, AFI_IP, argv[2]->arg); } + +/* ALIAS_FIXME */ +DEFUN (no_access_list_remark_comment, + no_access_list_remark_comment_cmd, + "no access-list <(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD> remark LINE...", + NO_STR + "Add an access list entry\n" + "IP standard access list\n" + "IP extended access list\n" + "IP standard access list (expanded range)\n" + "IP extended access list (expanded range)\n" + "IP zebra access-list\n" + "Access list entry comment\n" + "Comment up to 100 characters\n") +{ + return no_access_list_remark (self, vty, argc, argv); +} #ifdef HAVE_IPV6 @@ -1552,17 +1555,6 @@ DEFUN (ipv6_access_list_remark, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no ipv6 access-list WORD remark .LINE", - * NO_STR - * IPV6_STR - * "Add an access list entry\n" - * "IPv6 zebra access-list\n" - * "Access list entry comment\n" - * "Comment up to 100 characters\n" - * - */ DEFUN (no_ipv6_access_list_remark, no_ipv6_access_list_remark_cmd, "no ipv6 access-list WORD remark", @@ -1574,6 +1566,20 @@ DEFUN (no_ipv6_access_list_remark, { return vty_access_list_remark_unset (vty, AFI_IP6, argv[3]->arg); } + +/* ALIAS_FIXME */ +DEFUN (no_ipv6_access_list_remark_comment, + no_ipv6_access_list_remark_comment_cmd, + "no ipv6 access-list WORD remark LINE...", + NO_STR + IPV6_STR + "Add an access list entry\n" + "IPv6 zebra access-list\n" + "Access list entry comment\n" + "Comment up to 100 characters\n") +{ + return no_ipv6_access_list_remark (self, vty, argc, argv); +} #endif /* HAVE_IPV6 */ @@ -1962,6 +1968,7 @@ access_list_init_ipv4 (void) install_element (CONFIG_NODE, &access_list_remark_cmd); install_element (CONFIG_NODE, &no_access_list_all_cmd); install_element (CONFIG_NODE, &no_access_list_remark_cmd); + install_element (CONFIG_NODE, &no_access_list_remark_comment_cmd); } #ifdef HAVE_IPV6 @@ -2025,6 +2032,7 @@ access_list_init_ipv6 (void) install_element (CONFIG_NODE, &no_ipv6_access_list_all_cmd); install_element (CONFIG_NODE, &ipv6_access_list_remark_cmd); install_element (CONFIG_NODE, &no_ipv6_access_list_remark_cmd); + install_element (CONFIG_NODE, &no_ipv6_access_list_remark_comment_cmd); } #endif /* HAVE_IPV6 */ diff --git a/lib/routemap.c b/lib/routemap.c index f89d078028..88cdf97e55 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1530,16 +1530,6 @@ DEFUN (no_rmap_onmatch_next, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "continue", - * "Continue on a different entry within the route-map\n" - * - * "continue (1-65535)", - * "Continue on a different entry within the route-map\n" - * "Route-map entry sequence number\n" - * - */ DEFUN (rmap_onmatch_goto, rmap_onmatch_goto_cmd, "on-match goto (1-65535)", @@ -1549,9 +1539,8 @@ DEFUN (rmap_onmatch_goto, { char *num = NULL; if (!strcmp (argv[0]->text, "continue")) - if (argc == 2) - num = argv[1]->arg; - if (!strcmp (argv[0]->text, "on-match")) + num = argv[1]->arg; + else num = argv[2]->arg; struct route_map_index *index = vty->index; @@ -1575,8 +1564,7 @@ DEFUN (rmap_onmatch_goto, if (d <= index->pref) { /* Can't allow you to do that, Dave */ - vty_out (vty, "can't jump backwards in route-maps%s", - VTY_NEWLINE); + vty_out (vty, "can't jump backwards in route-maps%s", VTY_NEWLINE); return CMD_WARNING; } else @@ -1588,18 +1576,6 @@ DEFUN (rmap_onmatch_goto, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no continue", - * NO_STR - * "Continue on a different entry within the route-map\n" - * - * "no continue (1-65535)", - * NO_STR - * "Continue on a different entry within the route-map\n" - * "Route-map entry sequence number\n" - * - */ DEFUN (no_rmap_onmatch_goto, no_rmap_onmatch_goto_cmd, "no on-match goto", @@ -1617,10 +1593,27 @@ DEFUN (no_rmap_onmatch_goto, return CMD_SUCCESS; } -/* Cisco/GNU Zebra compatible ALIASes for on-match next */ - +/* Cisco/GNU Zebra compatibility aliases */ +/* ALIAS_FIXME */ +DEFUN (rmap_continue, + rmap_continue_cmd, + "continue (1-65535)", + "Continue on a different entry within the route-map\n" + "Route-map entry sequence number\n") +{ + return rmap_onmatch_goto (self, vty, argc, argv); +} -/* GNU Zebra compatible */ +/* ALIAS_FIXME */ +DEFUN (no_rmap_continue, + no_rmap_continue_cmd, + "no continue [(1-65535)]", + NO_STR + "Continue on a different entry within the route-map\n" + "Route-map entry sequence number\n") +{ + return no_rmap_onmatch_goto (self, vty, argc, argv); +} DEFUN (rmap_show_name, @@ -1630,9 +1623,7 @@ DEFUN (rmap_show_name, "route-map information\n" "route-map name\n") { - const char *name = NULL; - if (argc == 3) - name = argv[2]->arg; + const char *name = (argc == 3) ? argv[2]->arg : NULL; return vty_show_route_map (vty, name); } @@ -1809,6 +1800,8 @@ route_map_init_vty (void) install_element (RMAP_NODE, &no_rmap_onmatch_next_cmd); install_element (RMAP_NODE, &rmap_onmatch_goto_cmd); install_element (RMAP_NODE, &no_rmap_onmatch_goto_cmd); + install_element (RMAP_NODE, &rmap_continue_cmd); + install_element (RMAP_NODE, &no_rmap_continue_cmd); /* Install the continue stuff (ALIAS of on-match). */ diff --git a/lib/vty.c b/lib/vty.c index 2ecd1d5e0f..03a5308280 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2923,14 +2923,6 @@ DEFUN (terminal_monitor, return CMD_SUCCESS; } -/* - * CHECK ME - The following ALIASes need to be implemented in this DEFUN - * "no terminal monitor", - * NO_STR - * "Set terminal line parameters\n" - * "Copy debug output to the current terminal line\n" - * - */ DEFUN (terminal_no_monitor, terminal_no_monitor_cmd, "terminal no monitor", @@ -2942,6 +2934,16 @@ DEFUN (terminal_no_monitor, return CMD_SUCCESS; } +DEFUN (no_terminal_monitor, + no_terminal_monitor_cmd, + "no terminal monitor", + NO_STR + "Set terminal line parameters\n" + "Copy debug output to the current terminal line\n") +{ + return terminal_no_monitor (self, vty, argc, argv); +} + DEFUN (show_history, show_history_cmd, @@ -3151,6 +3153,7 @@ vty_init (struct thread_master *master_thread) install_element (CONFIG_NODE, &log_commands_cmd); install_element (ENABLE_NODE, &terminal_monitor_cmd); install_element (ENABLE_NODE, &terminal_no_monitor_cmd); + install_element (ENABLE_NODE, &no_terminal_monitor_cmd); install_element (ENABLE_NODE, &show_history_cmd); install_default (VTY_NODE);